This post is part of the series of Practical Malware Analysis Exercises.
.text:1000D02E
.idata:100163CC
Five functions call gethostbyname
.
It is called nine times (at first, I thought it was 18).
According to the book, page 495:
"Some versions of IDA Pro double-count cross-references: p is a reference because it is being called, and r is a reference because it is a "read" reference (since it is call dword ptr [...] for an import, the CPU must read the import and then call into it)."
pics.practicalmalwareanalysis.com
- Loads
dword_10019040
intoeax
, pointing to string at10019194
:'[This is RDO]pics.praticalmalwareanalysis.com',0
- Adds
0Dh
toeax
, jumping the pointer 13 bytes ahead so that it starts atpics....
. - Pushes the string pointer onto the stack and calls
gethostbyname
, passing the argument:pics.practicalmalwareanalysis.com
23
One: lpThreadParameter
.
xdoord_d:10095B34
Stores thecmd.exe /c
string, clears a buffer, and opens a receiving network socket.
Then it receives a remote command and executes it.
Graph view, shows comparisons of suggestive strings.
Guessing this is part of a remote shell.
sub_10003695
checks the platform version, and the return value is applied to dword_1008E5C4
.
Checked dword_1008E5C4
xrefs. One of the three references had "w" for write, at 10001687
.
sub_10003695
is called, and the return value is loaded into eax
, which is then
assigned to dword_1008E5C4
.
The function sub_10003695
checks the OS version, GetVersionExA()
. Compares result
to VER_PLATFORM_WIN32_NT
(0x02). If ZF=1
, then sets AL=1
and returns.
So essentially:
if version==VER_PLATFORM_WIN32_NT:
strCmdExe = cmd.exe
else:
strCmdExe = command.exe
10) A few hundred lines into sub_1000FF58
, are a series of memcmp's. What happens when comparison to "robotwork" is successful?
Gets data from the following registry key, formats it, and sends it over the network:
SOFTWARE\Microsoft\Windows\CurrentVersion\WorkTimes
- Calls
sub_100052A2
. sub_100052A2
tries to open registry keySOFTWARE\Microsoft\Windows\CurrentVersion
- If successful, reads a registry key
WorkTimes
," which is a string represented integer. - Combines the registry key value with a format string. Essentially:
sprintf(Dest,
"\r\n\r\n[Robot_WorkTimes :] %d\r\n\r\n",
atoi(strWorkTimes)
);
sub_100052A2
returns the constructed string.- Execution continues until
sub_100038EE
is called, which sends the finished string through the socket at10003933
. - The socket is initialized by
sub_10010740
: IPv4, TCP
List running processes and sends the information over a socket.
- Calls to
CreateToolhelp32Snapshot()
- Sends the name of the process and PID over the socket.
OpenProcess()
EnumProcessModules()
- Sends PID, exe path, and thread count over the socket.
- Writes process information to file
xinstall.dll
- Iterates around to the next process.
12) Graph XREF's from sub_10004E79
. Which API functions could be called by this function? Base on the API's alone, what could this function be renamed?
SendLanugage()
View -> Graphs -> Xrefs user chart
Depth of 1: 4 WinAPI functions.
Depth of 2: More than 4 WinAPI functions.
30,000ms = 30s
2, 1, 6.
16) Use MSDN for socket, and named symbolic constants feature. What parameters can be made more meaningful?
AF_INET = 2
(IPv4)SOCK_STREAM = 1
(TCP)IPPROTO_TCP = 6
(TCP)
17) Search for "in" instruction (0xED). Often used with string "VMXh" for VMWare detection. Is it present? Further signs of virtualization detection?
Yes, the in
instruction is present at 100061DB
with VX
and VMXh
strings.
Strange instruction at 10006152
, not in the Intel Architecture Manual:
10006152 vpcext 7, 0Bh
- Google only found 133 hits for
vpcext
. - Analyzing a Trojan not detected DElephant (Google Translate)
"There are few references to this instruction. Basically belong to Microsoft Virtual PC and its use in this context would have two hypothetical functions: Stop a debugger or the presence of Virtual PC."
Also found this string at xdoors_d:10094F88:Found Virtual Machine,Install Cancel.
Looks like the beginning of initialized data. A series of printable characters, with gaps of non-printable characters. Probably an encoded string.
Alt-F7
, ran script. Decoded the string:xdoor is this backdoor, string decoded for Practical Malware Analysis Lab :)1234
Hit A
to decode as an ASCII string.
XOR encoding with a value of 0x55,
- Starting at cursor location, loop for 0x50 bytes (80).
- Grab the byte.
- Perform bitwise XOR: b ^ 0x55 (85)
- Patch the resulting byte back.
sea = ScreenEA()
for i in range(0x00,0x50):
b = Byte(sea+i)
decoded_byte = b ^ 0x55
PatchByte(sea+i,decoded_byte)