LevelBlue Completes Acquisition of Cybereason. Learn more

LevelBlue Completes Acquisition of Cybereason. Learn more

Services
Cyber Advisory
Managed Cloud Security
Data Security
Manage Detection & Response
Email Security
Managed Network Infrastructure Security
Exposure Management
Security Operations Platforms
Incident Readiness & Response
SpiderLabs Threat Intelligence
Solutions
BY TOPIC
Offensive Security
Solutions to maximize your security ROI
Operational Technology
End-to-end OT security
Microsoft Security
Unlock the full power of Microsoft Security
Securing the IoT Landscape
Test, monitor and secure network objects
Why LevelBlue
About Us
Awards and Accolades
LevelBlue SpiderLabs
LevelBlue Security Operations Platforms
Security Colony
Partners
Microsoft
Unlock the full power of Microsoft Security
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings

Malicious Macros Evades Detection by Using Unusual File Format

A couple of months ago we observed an influx of XML spam attachments that were actually Office documents containing malicious macros. Last week, the same gang behind this campaign introduced another unusual trick.

The spam campaign's theme is the usual fake invoices.

10659_9359fa9e-a4d8-4857-bdae-d6c2db08c20b
Figure 1 Spam Sample

 

Here are some examples of the various subject lines associated with this campaign that we've spotted:

  • Important information
  • Financial Information
  • Need your attention, "Important notice
  • Payment details and copy of purchase [ ]

Last week, we observed an Italian version:

12836_fb6a9a44-1ef7-430d-8019-24925312d4aa
Figure 2. Italian Spam Campaign

 

As you can see in the screenshot, the attachment file may use a .doc or .xls file extension. But what's interesting is the file is actually an MHTML file.

8713_365a3f4c-76c6-4474-b9e4-387a4da14f55
Figure 3. examples of the Microsoft Office attachments (actually MSHTML) from this spam campaign

 

It seems that, after crafting the malicious macro document in MS Office, the criminals opted to save it as .MHTML instead of the usual .DOC/DOCX/XLS/XLSX type. After saving it, they renamed the file extension back to .doc or .xls. By doing this, opening the file will run the program associated with the file extension by default (in this case Microsoft Office).

12455_ea8b58aa-c78f-495e-a96f-54874b44b7b6
Figure 4. Document saved as .mhtml file

 

Below is how the .mhtml file looks like when viewed from a text editor. Highlighted in red is a base64 encoded ActiveMime part where the malicious Office Document file is hidden. When we first identified this this campaign, most antivirus products did not detect the malicious macros. I suspect the criminal purposefully saved it as .mhtml to evade antivirus detection.

11940_d1243fc5-5899-4750-be9d-99d91c2243b2
Figure 5

 

Analysis

To further understand the malicious document file, I've extracted the malicious OLE from the encoded ActiveMime document using a Python script I wrote. The script is crude but it works! You can get it here.

10383_862f7b2a-318f-4bf1-9cfc-4c884e39a329
Figure 6. Python script for extracting the OLE file

 

10616_91efd331-fabf-46b9-96ff-eae157fd4466
Figure 7. the extracted OLE document file

 

Next, I dumped the VBS macro code from the OLE file to analyze it. The go-to tool I use to extract macro code is OleDump written by Didier Stevens. I modified the tool to automatically find the offending macro and dump it using –m switch. Here you see the extracted macro and a URL string pointing to pastebin.com:

11440_b96d1ba3-2f15-498a-a244-1f6e42283cab
Figure 8. the dumped macro code shows a URL string pointing Pastebin download link

 

The macro obfuscation varies every day. A sample we collected last week shows that strings like the download link have been obfuscated.

10439_8963a6b2-e935-4c32-8379-65d835389e33
Figure 9. the macro script in obfuscated state

 

While the macro obfuscation varies from campaign to campaign, it essentially has the same behavior. The macro pulls a Visual Basic script (VBS) from pastebin.com then saves the script in the infected machine's temporary folder as a .vbs file then runs it. The script pulls another malicious executable from a URL: http://31.41.46.99/bt/get3[.]php

9162_4cafe1ac-e360-4956-8291-5f411e4af5e2
Figure 10. the downloader VBS script stored in pastebin.com

 

The downloaded executable payload is a banking Trojan called Dridex. It connects to the following IP addresses to download additional bot-configuration instructions:

  • 5.45.116.69:5443 - Estonia
  • 5.63.154.228:5443 - Russia
  • 62.76.191.84:5443 - Russia

The bot is designed to steal banking credentials by hooking browsers like Internet Explorer, Chrome, Firefox and Opera. It is also worth noting that the criminal has code-signed their Dridex executables to evade malware filters.

9529_5ec00cc8-2817-438c-9598-41489ff40ed9
Figure 11. Code signed Dridex's executable file

 

Conclusion

It's interesting that the gang behind these campaigns has utilized several types of Microsoft Office file formats to circumvent either antivirus detection or spam filters. Infection, though, is dependent on the victim allowing the macro to run. Always ensure you disable macros in your Microsoft Office applications.

9828_6e045677-4829-45f2-907d-9ad1ef30db9c
Figure 12. Disable macro in your Microsoft Office application

 

Trustwave Secure Email Gateway (SEG) can help detect these types of attachments.

ABOUT LEVELBLUE

LevelBlue is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.

Latest Intelligence

Discover how our specialists can tailor a security program to fit the needs of
your organization.

Request a Demo