Examining a piece of malware for strings (sequences of printable characters) can reveal a few clues about what the malware does, or what it is capable of doing. Part two demonstrates one way of finding the functions that reference the strings, and uses this information to hazard a guess at what those functions do.
Part one demonstrated how you can get an inkling about what a piece of (non-obfuscated) malware may do, by looking at the strings contained within it. In this part, I will take this a bit further and use a debugger to find which functions reference the various strings. From this, I will then have a stab at what the purpose of each function is. The next part (part three) will go one step further and disassemble the functions to see how accurately the string based predictions reflect each function’s actual functionality.
The debugger I chose to use was the free edition of IDA Pro. IDA Pro automatically generates a ‘Strings’ sub-view, however, I would like to select all of strings (doing each string individually will be quite annoying, and won’t generate the nice graph which makes it easy to see what is going on). To do this, I opened the ‘Segments’ sub-view, and from there, opened the ‘.data’ segment (section) by double-clicking it.
I then selected the range of recognisable strings, and the memory locations containing the offsets of the recognisable strings, and generated a ‘Xrefs to’ graph. This showed, quite nicely, the strings referenced by each function.
From the ‘Xrefs to’ graph, I saw the following functions referencing the strings:
PHIME2008 Software\Microsoft\Windows\CurrentVersion\Run /SYNC
lg1=%s&lg2=%s&lg3=%s&lg4=%s&lg5=%s&lg6=%s&lg7=%d GET /updata/TPDB.php? NONE HTTP/1.1 1.003 22.214.171.124
lg1=%s&lg2=%s&lg3=%s&lg4=%s&lg5=%s&lg6=%s GET /updata/TPDA.php? HTTP/1.1 1.003 126.96.36.199
\\%s %d.%d.%d.%d .
"!" (offset of '!')
at cp %s TaskOK %s %s %s dnsapi.exe %s CopyOK %s %s %s %s\admin$\system32\dnsapi.exe (looks like share name and file name) %s %s LoginOK %s %s %s
From that then, I suggest the functions do the following:
Installs the malware in the registry ‘Run’ key, as ‘PHIME2008’.
Requests /updata/TPDB.php?lg1=%s&lg2=%s&lg3=%s&lg4=%s&lg5=%s&lg6=%s&lg7=%d from 188.8.131.52 ([censored].jp).
Requests /updata/TPDA.php?lg1=%s&lg2=%s&lg3=%s&lg4=%s&lg5=%s&lg6=%s from 184.108.40.206 ([censored].jp).
Appends another string to URL using ‘%20’ (encoded space) as separator.
Spits out a time stamp string in the format yyyyMMddhhmmss.
May download http://%5Bcensored%5D.jp/updata/ACCl3.jpg to ‘msupd.exe’ somewhere.
May construct start of UNC name using IP address as server name.
Is a little vague!
May connect to IPC$ share, or append it to UNC name from sub_401870().
Also a little vague!
‘at’ and ‘cp’ look like commands. The ‘TaskOK’, ‘CopyOK’, and ‘LoginOK’ look like log messages or command responses. %s\admin$\system32\dnsapi.exe looks like it could be either the target or the source of a copy. This function may implement the commands.
IDA Pro couldn’t find any references to the strings of day names, nor to the strings of month names.
That seems like a logical place to end this part. Part three will use IDA Pro (free edition) to disassemble the functions and see how accurate the strings based predictions are.