Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More
Get access to immediate incident response assistance.
Get access to immediate incident response assistance.
Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More
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.
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.
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.
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.
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:
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.
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”
Then tadaa! Now it reveals the hidden column “A” with all this suspicious EXEC formulas to run external commands
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")”
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:
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
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.
1e1afc93c8092b2c7e49a6d3a451629f (XLSB)
40a941bc585c6e8f1203a9854faf90ad (Jscript 2nd stage payload)
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.
Copyright © 2024 Trustwave Holdings, Inc. All rights reserved.