This hunt hypothesis targets adversaries utilizing the PSCRAMBLER obfuscation technique to conceal malicious PowerShell scripts from static analysis and signature-based detection. Proactively hunting for this behavior in Azure Sentinel is critical because obfuscated scripts often bypass initial security controls, requiring dynamic behavioral analysis to uncover hidden command execution patterns that standard rules might miss.
rule pscrambler12byp0ke
{
meta:
author="malware-lu"
strings:
$a0 = { 55 8B EC B9 04 00 00 00 6A 00 6A 00 49 75 F9 51 53 [4] 10 E8 2D F3 FF FF 33 C0 55 68 E8 31 00 10 64 FF 30 64 89 20 8D 45 E0 E8 53 F5 FF FF 8B 45 E0 8D 55 E4 E8 30 F6 FF FF 8B 45 E4 8D 55 E8 E8 A9 F4 FF FF 8B 45 E8 8D 55 EC E8 EE F7 FF FF 8B 55 EC B8 C4 54 00 10 E8 D9 EC FF FF 83 3D C4 54 00 10 00 0F 84 05 01 00 00 80 3D A0 40 00 10 00 74 41 A1 C4 54 00 10 E8 D9 ED FF FF E8 48 E0 FF FF 8B D8 A1 C4 54 00 10 E8 C8 ED FF FF 50 B8 C4 54 00 10 E8 65 EF FF FF 8B D3 59 E8 69 E1 FF FF 8B C3 E8 12 FA FF FF 8B C3 E8 33 E0 FF FF E9 AD 00 00 00 B8 05 01 00 00 E8 0C E0 FF FF 8B D8 53 68 05 01 00 00 E8 57 F3 FF FF 8D 45 DC 8B D3 E8 39 ED FF FF 8B 55 DC B8 14 56 00 10 B9 00 32 00 10 E8 BB ED FF FF 8B 15 14 56 00 10 B8 C8 54 00 10 E8 53 E5 FF FF BA 01 00 00 00 B8 C8 54 00 10 E8 8C E8 FF FF E8 DF E0 FF FF 85 C0 75 52 6A 00 A1 C4 54 00 10 E8 3B ED FF FF 50 B8 C4 54 00 10 E8 D8 EE FF FF 8B D0 B8 C8 54 00 10 59 E8 3B E6 FF FF E8 76 E0 FF FF B8 C8 54 00 10 E8 4C E6 FF FF E8 67 E0 FF FF 6A 00 6A 00 6A 00 A1 14 56 00 10 E8 53 EE FF FF 50 6A 00 6A 00 E8 41 F3 FF FF 80 3D 9C 40 00 10 00 74 05 E8 EF FB FF FF 33 C0 5A 59 59 64 89 10 68 EF 31 00 10 8D 45 DC BA 05 00 00 00 E8 7D EB FF FF C3 E9 23 E9 FF FF EB EB 5B E8 63 EA FF FF 00 00 00 FF FF FF FF 08 00 00 00 74 65 6D 70 2E 65 78 65 }
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.
Here are 5 specific false positive scenarios for the pscrambler12byp0ke YARA rule, including targeted filters and exclusions:
Scenario: Automated Patch Deployment via SCCM/Intune
ccmsetup.exe or Microsoft.Workplace.Join) often invokes PowerShell scripts that dynamically generate obfuscated code blocks to handle complex logic, triggering the YARA signature for script scrambling patterns.Exclude if Parent Process Name is 'ccmsetup.exe' or 'Microsoft.Workplace.Join' AND Path starts with 'C:\Program Files (x86)\Microsoft Configuration Manager\'.Scenario: CI/CD Pipeline Execution by Jenkins/GitLab Runner
java.exe running a GitLab Runner or Jenkins node) execute PowerShell scripts to compile code and run unit tests. These scripts frequently utilize inline base64-encoded commands for security context switching, which the rule interprets as potential obfuscation attempts by an attacker.Exclude if Parent Process Name is 'java.exe' AND Command Line contains '-agent' OR Path matches 'C:\ProgramData\GitLab\runner\'.Scenario: Scheduled Inventory and Compliance Scans (Qualys/Tanium)