Analysis
Model-nop skips the user profile, -w hidden hides the window, and -enc takes a base64, UTF-16LE script so the command line shows no readable code. Together they are a common way to launch a stager quietly. Decode the blob first: the payload, not the flags, tells you what ran.
Proposed rule
Modeltitle: Hidden PowerShell with an encoded command
logsource:
category: process_creation
product: windows
detection:
image:
Image|endswith: '\powershell.exe'
hidden:
CommandLine|contains|all:
- ' -nop'
- ' -w hidden'
encoded:
CommandLine|contains:
- ' -enc '
- ' -EncodedCommand '
condition: all of them
level: highReview note: attackers shorten flags to -e or -ec and run pwsh.exe. Widen the rule before it ships.
Cases to replay
Your lab| Command line | Expected |
|---|---|
powershell.exe -nop -w hidden -enc SQBFAFgA… | Alert |
powershell.exe -NoProfile -File backup.ps1 | No alert |
pwsh.exe -nop -w hidden -ec SQBFAFgA… | Missed, widen rule |