Summary
In October 2023, Netskope analyzed a malicious Word document and the malware it contained, dubbed “Menorah.” The malware was attributed to an advanced persistent threat group APT34, and was reported to be distributed via spear-phishing. The malicious Office file uses dispersed and obfuscated VBA code to evade detection.
The advanced persistent threat group targets users of outdated versions of Microsoft Office, since it does not attempt to bypass the mark of the web security check. Malicious Word documents still rank among the top of malware file types based on the latest Netskope Threat Labs threat stats, and in June 2023, we observed that Emotet malware still used macros to download and execute their payloads.
Analysis
Initially, opening the file will show a blank document with an instruction to enable macros. When the user clicks “Enable Content,” the auto-trigger routine in the code will execute. Once the main function is called, the code is deobfuscated and executed through additional VBA functions inside the document.
To help bypass AV and static-based detections, the VBA project is password protected and macros are obfuscated using the Chr( ) VBA function. The payload, when deobfuscated, is in base64 format, as depicted below.
A couple of lengthy strings are stored inside the text field of the userform. These strings are decoded by the macro code and concatenated with other strings scattered on the code to form XSL strings. The XSL strings contain the VBScript code and XSL execution is performed using the TransformNode method of the DOMDocument COM object. The screenshot below shows the VBA macro that performs the XSL script execution.
Once the VBScript is executed, a hardcoded PE file is dropped named “Menorah.exe”. Using the static analysis tool Detect It Easy, we can see that the dropped file is a DotNET executable.