Detect Software Packing in Splunk
Adversaries may perform software packing or virtual machine software protection to conceal their code. Software packing is a method of compressing or encrypting an executable. Packing an executable changes the file signature in an attempt to avoid signature-based detection. Most decompression techniques decompress the executable code in memory. Virtual machine software protection translates an executable's original code into a special format that only a special virtual machine can run. Common packers include UPX, MPRESS, Themida, VMProtect, and custom packers. APT41, APT39, Lazarus Group, Aoqin Dragon, and many commodity malware families including LockBit, QakBot, and Cobalt Strike use software packing.
MITRE ATT&CK
- Tactic
- Defense Evasion
- Technique
- T1027 Obfuscated Files or Information
- Sub-technique
- T1027.002 Software Packing
- Canonical reference
- https://attack.mitre.org/techniques/T1027/002/
SPL Detection Query
index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=7
(ImageLoaded="*\\upx*" OR Description="*UPX*" OR ImageLoaded="*\\themida*"
OR ImageLoaded="*\\vmprotect*" OR Description="*packed*")
NOT (Image="C:\\Windows\\*" OR Image="C:\\Program Files\\*")
| stats count as LoadCount, values(ImageLoaded) as Modules, values(Image) as ProcessPaths
by host, User
| where LoadCount > 1
| sort - LoadCount
| appendcols [
search index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
(Image="*upx.exe" OR Image="*themida.exe" OR Image="*vmprotect.exe" OR Image="*mpress.exe")
| stats count as PackerExecs, values(CommandLine) as PackerCmds, values(Image) as PackerImages
by host
] Detects packer-related DLL/module loads (Sysmon Event ID 7) and packer tool execution (Event ID 1). Sysmon image load events may capture packer runtime modules loaded by a packed binary during its self-extraction phase. Combines module load detection with direct packer tool execution to provide two independent signals.
Data Sources
Required Sourcetypes
False Positives & Tuning
- Legitimate packed open-source utilities (many tools use UPX compression for distribution size reduction)
- Corporate software deployments using SFX packages for installation on endpoints
- Security tools and EDR agents that use packing/obfuscation for their own components
- Development workstations where packer tools are installed for legitimate use
Other platforms for T1027.002
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Pack an Executable with UPX
Expected signal: Sysmon Event ID 1: upx.exe process creation with '--best' flag and output path. Sysmon Event ID 11: File Create for packed_target.exe in %TEMP%. The output file will have different SHA256 than the input, smaller file size, and UPX-specific section names (.UPX0, .UPX1).
- Test 2Identify Packed Binary with PE Entropy Check
Expected signal: Sysmon Event ID 1: sigcheck.exe process creation with the target binary path. Output will show section entropy values. For a UPX-packed binary, sections will show entropy near 7.8-8.0.
- Test 3Simulate Packed Malware Self-Extraction Pattern
Expected signal: Sysmon Event ID 1: powershell.exe with Assembly.Load command. Sysmon Event ID 11: Temp file creation followed by deletion. PowerShell ScriptBlock Log Event ID 4104 with the full script including Assembly.Load. This pattern (write to disk + load + delete) is characteristic of packed dropper behavior.
- Test 4Download and Execute UPX to Pack a Binary
Expected signal: Sysmon Event ID 1: PowerShell with Invoke-WebRequest (download cradle). Sysmon Event ID 3: Network connection to github.com. Sysmon Event ID 11: upx.zip download, extraction. Sysmon Event ID 1: upx.exe execution on victim_payload.exe.
References (5)
Unlock Pro Content
Get the full detection package for T1027.002 including response playbook, investigation guide, and atomic red team tests.