This rule identifies executable files packed with specific PECompact variants, a technique adversaries frequently employ to compress and obfuscate malware payloads to evade static analysis and signature-based detection. Proactively hunting for these packed binaries in Azure Sentinel allows the SOC team to uncover stealthy threats that may be hiding in endpoint memory or storage, ensuring that obfuscated executables are identified before they can execute or propagate within the environment.
rule PECompact_v126b1_v126b2: PEiD
{
strings:
$a = { EB 06 68 ?? ?? ?? ?? C3 9C 60 E8 02 ?? ?? ?? 33 C0 8B C4 83 C0 04 93 8B E3 8B 5B FC 81 EB 0F 70 40 ?? 87 DD 8B 85 A6 70 40 ?? 01 85 03 70 40 ?? 66 C7 85 70 40 90 ?? 90 01 85 9E 70 40 BB ?? 05 0E }
condition:
$a at pe.entry_point
}
This YARA rule can be deployed in the following contexts:
This rule contains 1 string patterns in its detection logic.
v126b1 or v126b2 internal version strings which are common in older UPX builds or specific PECompact forks.
C:\Builds\Release\, D:\Artifacts\) or exclude executables with names matching *.exe where the parent folder contains dist, release, or build.C:\Program Files\SAP\, C:\Program Files\Oracle\) or exclude processes whose parent process is a known service host (e.g., services.exe or svchost.exe) if the file path matches a whitelist of legacy vendors.cleanup.exe or archive_tool.exe) that was packed with PECompact to reduce disk footprint. This utility is executed by Task Scheduler or cron on a weekly basis.
C:\Windows\System32\Tasks\ associated binaries or specific utility directories (e.g., C:\AdminTools\, C:\Scripts\) if the file modification date is older than 90 days and the file size is under 5MB.