This rule detects the presence of PECompact-packed executables, a technique adversaries often use to compress and obfuscate malicious payloads to evade static analysis and signature-based detection. Proactively hunting for these artifacts in Azure Sentinel allows the SOC team to identify potentially hidden or stealthy malware that may have been deployed via phishing or lateral movement, reducing the risk of undetected compromise in the environment.
rule PECompactv0977
{
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 A0 86 40 ?? 87 DD 8B 85 2A 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 executable by a deployment automation tool (e.g., Ansible, Puppet, or SCCM) during a mass software update cycle.
ansible-playbook.exe, puppet-agent.exe, SCCMClient.exe) or where the image path resides in a standard deployment directory (e.g., C:\Program Files\SCCM\, C:\ansible\).PECompact.exe from a local build folder to optimize a custom application binary before release.
Dev-Team, QA-Engineers) and the image path is located within a user profile or a designated build workspace (e.g., C:\Users\<user>\builds\, D:\projects\).PECompact as part of a post-build optimization step in a containerized or virtualized build environment.
jenkins-agent.jar, gitlab-runner.exe, vsts-agent.exe) or where the process is running inside a known container runtime path (e.g., C:\ProgramData\docker\, C:\Program Files\containerd\).PECompact to reduce the footprint of installed binaries during a scheduled maintenance window.