In a previous blog, we talked about the return of the Mega-D botnet (a.k.a Ozdok) in the wake of the McColo shutdown, which is one of the major botnet responsible for sending close to 50% of all spams. Currently, we thought we would have a closer look at this bot.
Mega-D has a unique way of hiding itself from detection. It tries to fool users by creating a new process of Svchost.exe, (a legitimate component of Windows) and injects its code into this process.
After creating a fake but legitmate looking Windows process, Mega-D copies itself into the Windows system directory as an Alternate Data Stream(ADS) using the filename “svchost.exe:ext.exe”. This is a clever method of hiding malicious files from detection since neither Windows Explorer nor cmd.exe will reveal ADS streams, unless using a special tool such as Streams from Sysinternals.
Mega-D then creates a service for the drop file to auto-execute on system startup. “FCI” is the display name for this specific Mega-D sample (md5 hash: EB6C85A3D3A17CDC4DC50CF018322A59, packed using UPX).
It looks like this in the Services management console once registered:
After Mega-D transfer its control to the injected code, it then terminates and deletes the executed malware to further reduce its footprint and the likelihood of detection. With the injected code, Mega-D performs a DNS query on one of the following domains:
Once the DNS query succeed, Mega-D will send a test message:
Here is a sample SMTP transaction when Mega-D sends a test message:
Older samples tries to connect to majzufaiuq.info which is currently an unregistered domain. It will then attempt to connect to its C&C server and we observed Mega-D connect to addresses using port 80:
It was also observed that it downloaded an updated binary from 126.96.36.199:80 / mss32.exe (please note: link was intentionally broken).
The message body is usually in HTML format only with themes focus on fake designer products, male enlargement, sexual enhancement, current news topic and using NDR subject lines like:
Delivery Status Notification
Delivery Status Notification (Failure)
RE: Order Status
Here's a sample spam from Mega-D:
In summary, the Mega-D malware uses sophisticated methods for optimizing stealth. It is difficult to identify, even by experienced users, without specialized analysis tools. It is designed to be flexible when attempting connections with Command and Control Servers and uses a range of methods to update itself. It is a very professionally written piece of malware.