Trustwave SpiderLabs Exposes Unique Cybersecurity Threats in the Public Sector. Learn More

Trustwave SpiderLabs Exposes Unique Cybersecurity Threats in the Public Sector. Learn More

Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Offensive Security
Solutions to maximize your security ROI
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

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.

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 [<Random AlphaNumeric>]

Last week, we observed an Italian version:

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.

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).

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.

Figure 5



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.

Figure 6. Python script for extracting the OLE file


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

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.

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 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:[.]php

Figure 10. the downloader VBS script stored in


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

  • - Estonia
  • - Russia
  • - 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.

Figure 11. Code signed Dridex's executable file



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.

Figure 12. Disable macro in your Microsoft Office application


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

Latest SpiderLabs Blogs

Important Security Defenses to Help Your CISO Sleep at Night

This is Part 13 in my ongoing project to cover 30 cybersecurity topics in 30 weekly blog posts. The full series can be found here.

Read More

2024 Public Sector Threat Landscape: Trustwave Threat Intelligence Briefing and Mitigation Strategies

Trustwave SpiderLabs’ 2024 Public Sector Threat Landscape: Trustwave Threat Intelligence Briefing and Mitigation Strategies report details the security issues facing public sector security teams as...

Read More

How to Create the Asset Inventory You Probably Don't Have

This is Part 12 in my ongoing project to cover 30 cybersecurity topics in 30 weekly blog posts. The full series can be found here.

Read More