This rule identifies obfuscated or hidden Portable Executable (PE) files linked to BGCorp, suggesting an adversary is employing file obfuscation techniques to evade static analysis and signature-based detection. Proactively hunting for these artifacts in Azure Sentinel allows the SOC to uncover stealthy persistence mechanisms or initial access payloads that may have slipped past standard endpoint monitoring.
rule Hide_PE_101_BGCorp: PEiD
{
strings:
$a = { ?? BA ?? ?? ?? 00 B8 ?? ?? ?? ?? 89 02 83 C2 04 B8 ?? ?? ?? ?? 89 02 83 C2 04 B8 ?? ?? ?? ?? 89 02 83 C2 F8 FF E2 0D 0A 2D 3D 5B 20 48 69 64 65 50 45 20 62 79 20 42 47 43 6F 72 70 20 5D 3D 2D }
$b = { BA ?? ?? ?? 00 B8 ?? ?? ?? ?? 89 02 83 C2 04 B8 ?? ?? ?? ?? 89 02 83 C2 04 B8 ?? ?? ?? ?? 89 02 83 C2 F8 FF E2 0D 0A 2D 3D 5B 20 48 69 64 65 50 45 20 62 79 20 42 47 43 6F 72 70 20 5D 3D 2D }
condition:
for any of ($*) : ( $ at pe.entry_point )
}
This YARA rule can be deployed in the following contexts:
This rule contains 2 string patterns in its detection logic.
7z.exe, Inno Setup installers, or NSIS scripts) that embed a PE header within a compressed or packed container, causing the YARA rule to match the underlying binary structure.
.7z, .zip, .rar, or .exe located in standard installation directories (e.g., C:\Program Files\, C:\Temp\) if the parent process is a known installer (msiexec.exe, setup.exe, 7zG.exe).UPX (Ultimate Packer for eXecutables) to compress binaries for size optimization or to test packing behavior, resulting in a PE file with a modified header that matches the “hidden” or obfuscated signature.
C:\Users\<dev_user>\Projects\, C:\dev\) or when the parent process is a known IDE or build tool (devenv.exe, code.exe, msbuild.exe).%TEMP%, C:\Windows\Temp) which may retain PE headers even when stored as data files.
%TEMP% or C:\Windows\Temp if the parent process is a known backup agent (VeeamAgent.exe, commvault.exe) or a scheduled task service (svchost.exe with specific service names).