This post is part of the series of Practical Malware Analysis Exercises.
This one has a reverse backdoor that starts an invisible console, and attaches a connected socket to stdin, stdout and stderr. Attacker just has to run netcat on the remote host, wait for connections, and has a console waiting. To protect itself, the malware verifies its filename and XOR decodes the URL.
Nothing obvious. Just DLL and function names.
Creates a bidirectional backdoor out of cmd.exe
and a socket.
- No registry changes.
- No references to argc or argv. No command line parameters.
- Verifies name=
ocl.exe
- Decodes a URL with predefined XOR array.
- DNS query of domain
practicalmalwareanalysis.com
gethostbyname
returnshostent
structure. IP address can be found athostent+0x1C
(28 bytes in).- Tries to connect to
practicalmalwareanalysis.com:9999/tcp
- Verifies name=
Rename file to ocl.exe
.
Assigns a character array, one byte at a time: 1qaz2wsz3edc
- arg1 = A scrambled source string,
1qaz2wsz3edc
- arg2 = An array of 32 integers.
www.practicalmalwareanalysis.com
XOR against predefined 32 byte array with wrapping (modulo).
for( c=0; c<32; c++)
result[c] = xor_byte[c] XOR src_byte[c%str_len]
Starts an instance of cmd.exe
with the connected socket as standard input/output/error.