This rule detects the presence of PECompact, a specific executable compression tool often used by adversaries to reduce the size of malware payloads and evade basic file-based detection mechanisms. Proactively hunting for this indicator in Azure Sentinel allows the SOC team to identify potentially obfuscated binaries early, ensuring that compressed executables are not overlooked during initial triage or endpoint monitoring.
rule PECompactv20betaJeremyCollake
{
meta:
author="malware-lu"
strings:
$a0 = { B8 [4] 05 [4] 50 64 FF 35 00 00 00 00 64 89 25 00 00 00 00 CC 90 90 90 90 }
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 (specifically version 2.0 beta) by a developer or build engineer to optimize the size of a custom C++ application before deployment.
devenv.exe, code.exe) or build tools (e.g., msbuild.exe, dotnet.exe) and the command line contains arguments like /compact or /optimize.PECompact binary to compress large native libraries (e.g., libcrypto.dll, libssl.dll) during a monthly patch cycle.
C:\Patches\, C:\Updates\) and the execution time aligns with the documented maintenance window (e.g., 02:00–04:00 AM).PECompactv20beta sample binary in an isolated test VM or a designated “canary” host.
SOC-Test-VMs) or exclude processes where the command line explicitly contains a test identifier (e.g., --test-mode or yara-test).PECompact engine to compress executable files during nightly backups, running under a service account.
vendor_backup_svc.exe) and the user context