Change User Agents with WebRequest
A Sigma rule for PowerShell script blocks on Windows, by frack113.
medium 1 ATT&CK technique
What it looks for
detection:
selection_useragent:
ScriptBlockText|contains: '-UserAgent '
selection_webrequest:
ScriptBlockText|contains:
- 'Invoke-WebRequest'
- 'Invoke-RestMethod'
- ' irm '
- 'iwr '
condition: all of selection_*
The rule’s detection, its selections and fields in order of name. The whole rule, with its references and false positives, is on SigmaHQ, by frack113, under the Detection Rule License 1.1. CmdID evaluates it on the PowerShell script a command line runs, as script block logging records it: a test on what a command line cannot show, such as the parent process or the user, is not met.
None of the everyday examples and documented commands on CmdID’s program pages trips it. To see whether a command line does, paste it into CmdID.
ATT&CK
T1071.001Application Layer Protocol: Web Protocols