This rule detects the presence of PECompact-packed executables, a technique adversaries may use to compress malware binaries to evade static analysis and reduce file size. Proactively hunting for these artifacts in Azure Sentinel allows the SOC team to identify potentially obfuscated payloads that could be staging for execution or lateral movement within the environment.
rule PECompactv09781
{
meta:
author="malware-lu"
strings:
$a0 = { EB 06 68 [4] C3 9C 60 E8 02 [3] 33 C0 8B C4 83 C0 04 93 8B E3 8B 5B FC 81 EB 49 87 40 ?? 87 DD 8B 85 CE 87 }
condition:
$a0 at pe.entry_point
}
This YARA rule can be deployed in the following contexts:
This rule contains 1 string patterns in its detection logic.
PECompact utility (or its variants like PECompact.exe) by a DevOps engineer or build server to compress executable files for reduced disk footprint or faster deployment. This is a common practice in CI/CD pipelines or when preparing installers for distribution.
Jenkins.exe, AzureDevOpsAgent.exe, TeamCity.exe) or where the command line contains arguments typical of compression tasks (e.g., /c, compress, minify).setup.exe for older enterprise software like legacy ERP or CAD tools) invokes PECompact internally during the installation phase to optimize the size of installed binaries.
msiexec.exe, setup.exe, install.exe) and the file path of the compacted binary resides within a standard application directory (e.g., C:\Program Files\, C:\Program Files (x86)\).Task Scheduler (svchost.exe with specific service names) or powershell.exe where the working directory is a known maintenance or temp folder (e.g., C:\Temp\, C:\Maintenance\) and the target file extension is .exe or .dll in a non-system path.PECompact on a