Co-authored by Ghanashyam Satpathy and Jenko Hwong
Summary
Attackers have long used phishing emails with malicious Microsoft Office documents, often hosted in popular cloud apps like Box and Amazon S3 to increase the chances of a successful lure. The techniques being used with Office documents are continuing to evolve.
In August – September of 2020, we analyzed samples that used advanced techniques like:
- Constructing a PowerShell script at runtime.
- Constructing WMI namespaces at runtime.
- Using VBA logic obfuscation to evade static and signature-based detections.
In January 2021, we examined samples that use obfuscation and embedded XSL scripts to download payloads.
In this blog post, we will examine a new set of malicious Office documents using additional techniques to evade signature-based threat detection, including:
- Embedded base64 payloads
- Code injection
This is the first time we have seen attackers using Office documents that use both VBA and LoLbins (certutil.exe
and mavinject.exe
). This blog post provides a default teardown of how these techniques are being used by the Lazarus Group.
Analysis
In this blog post, we examine a malicious Microsoft Word document linked to the Lazarus Group:
MD5
648dea285e282467c78ac184ad98fd77
SHA-1
5c194ec7cfe33dd738fca71adf960c85e6ed7646
SHA-256
8e1746829851d28c555c143ce62283bc011bbd2acfa60909566339118c9c5c97
The techniques used in the sample include:
- Embedded payload in base64
- Decoding the base64 payload using
certutil.exe
- Using
mavinject.exe
for code injection
Mavinject.ext
and certutil.exe
are Windows LoLbins (living off the land binaries), used by this sample to connect to the C&C servers and download next stage payloads.
Embedded base64 payload
The sample is a Word document (screenshot below) that prompts the user to click the “Enable Content” button. The macro code has an auto-trigger routine to execute as soon as “Enable Content” is clicked.
The initial payload is stored inside the VBA code as a base64 encoded string. The base64 string is saved into a file on the local disk and later decoded back into a PE file. For decoding it uses certutil.exe
, a Windows utility installed as part of Certificate Services that is used to configure Certificate Services, backup and restore CA components, and verify certificates and key pairs. The VBA code references certutil.exe
using a wildcard string (certut*
) inside the VBA code. The use of a wildcard is to evade simple pattern match on certutil.exe
. The VBA script invokes certutil.exe
with the -decode
command line option to decode the base64 encoded data.
The following screenshot shows the VBA project. The base64 string can be seen inside the VBA code. The VBA Function WLQGQifZzoSMZHc
is invoked inside Document_Open():