Blogs & Stories

SpiderLabs Blog

Attracting more than a half-million annual readers, this is the security community's go-to destination for technical breakdowns of the latest threats, critical vulnerability disclosures and cutting-edge research.

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.

Figure 1. Spam Sample


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.

Figure 3. XLSB File Header



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.

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.

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:

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.

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

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

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")”

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
    2. regsvr32 /s mery.dll, Run
  8. Execute a powershell command from:
    1. http://kilolo.site/raw.txt
    2. https://kilolo.site/raw.txt
  9. Execute mshta
  10. Execute a Jscript from a remote server using AppLocker Bypass technique:
    1. regsvr32 /s /u /n /i: 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 The deobfuscated and beautified code can be found here: https://gist.githubusercontent.com/drole/b66464abca888f5cc77ea4519acd1584/raw/1c07055fbaaa4911b5cdf5d754e034ffd6ac8810/payload.js


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.  


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

Recent SpiderLabs Blog Posts