This rule detects the presence of PEncrypt20, a lightweight encryption utility often embedded in malicious scripts or payloads to obfuscate data and hinder forensic analysis. Proactively hunting for this artifact allows the SOC team to identify potential low-and-slow persistence or data staging activities that may otherwise go unnoticed due to the tool’s minimal footprint and low severity classification.
rule PEncrypt20junkcode
{
meta:
author="malware-lu"
strings:
$a0 = { EB 25 00 00 F7 BF 00 00 00 00 00 00 00 00 00 00 12 00 E8 00 56 69 72 74 75 61 6C 50 72 6F 74 65 63 74 00 00 00 00 00 E8 00 00 00 00 5D 81 ED 2C 10 40 00 8D B5 14 10 40 00 E8 33 00 00 00 89 85 10 10 40 00 BF 00 00 40 00 8B F7 03 7F 3C 8B 4F 54 51 56 8D 85 }
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.
gcc or clang with optimization flags (e.g., -O2 or -Os) that insert padding or alignment bytes, resulting in a binary containing sequences of 0x00 or 0xFF that match the “junk code” pattern.
C:\build\, /opt/build/, ~/projects/) or files with extensions .a, .so, .dll, and .exe if they are owned by service accounts or developer groups.C:\ProgramData\Veeam\Backup\, /var/lib/commvault/) and files with extensions .vbk, .vib, .bkp, or .tmp created by known backup service accounts.0x00) before data is written, triggering the junk code detection on the file header or padding regions.
C:\Windows\Temp\, /tmp/, or application-specific temp directories (e.g., C:\Users\<user>\AppData\Local\Temp\) if the file size is less than 1MB and the creation time is recent (< 1 hour).