Detection rules › Splunk
Invoke-WebRequest Command (PowerShell)
Detects when typical download commands are executed
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Telemetry coverage
Rule body
id: '5443.5592'
title: Invoke-WebRequest Command
description: 'Detects when typical download commands are executed -- Threat Actor
Association: APT28/Fancy Bear, FIN13, Flax Typhoon, Kimsuky, Memento Team, NewsPenguin,
Prophet Spider, TA2541, TA505, WinterVivern/UAC-0114, Wizard Spider -- Software
Association: ALPHV/BlackCat, Alchimist, Bazar, Babuk, Clop, Cuba, DarkGate, LV,
Qakbot/Qbot, TargetCompany, Trickbot, Remcos RAT, XingLocker, Yanluowang, Zloader
-- Atomics T1041 Test#1 Atomics T1074.001 Test#1 Atomics T1572 Test#1 Atomics T1566.001
#Test1 Atomics T1087.002 Test #4'
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_powershell` (EventCode=4103 OR EventCode=4104)
AND (TERM(IWR) OR TERM(Invoke-WebRequest) OR TERM("Invoke-RestMethod") OR TERM(curl)
OR TERM(wget)) | rex field=process (?<uri>"(?i)(https?\:|ftp(\:|\.)|(\d{1,3}\.){3}\d{1,3})[A-Za-z0-9\x5c\/\_\+\-\%\.\:]+")
| rex field=process "(?i)(?<cmd>invoke-webrequest|invoke-restmethod|wget|iwr|curl)"
| where isnotnull(cmd) | table _time, host, user cmd, process, process_name, shell,
signature_id, user, user_id, uri | bin span=1s | stats values(*) as * by _time,
host '
techniques:
- execution:command and scripting interpreter:powershell
- command-and-control:ingress tool transfer
technique_id:
- T1059.001
- T1105
data_category:
- PowerShell logs
- Process command-line parameters
references: null
Stages and Predicates
Stage 1: search
`get_endpoint_data` `get_endpoint_data_powershell` (EventCode=4103 OR EventCode=4104) AND (TERM(IWR) OR TERM(Invoke-WebRequest) OR TERM("Invoke-RestMethod") OR TERM(curl) OR TERM(wget))
Stage 2: rex
| rex field=process (?<uri>"(?i)(https?\:|ftp(\:|\.)|(\d{1,3}\.){3}\d{1,3})[A-Za-z0-9\x5c\/\_\+\-\%\.\:]+")
Stage 3: rex
| rex field=process "(?i)(?<cmd>invoke-webrequest|invoke-restmethod|wget|iwr|curl)"
Stage 4: where
| where isnotnull(cmd)
Stage 5: table
| table _time, host, user cmd, process, process_name, shell, signature_id, user, user_id, uri
Stage 6: bucket
| bin span=1s
Stage 7: stats
| stats values(*) as * by _time, host
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
EventCode | eq |
| field:"EventID" kind:eq |
cmd | is_not_null | field:"cmd" kind:is_not_null |
Search terms
These SPL tokens match against raw event text.
| Stage | Term |
|---|---|
| 1 | IWR |
| 1 | "Invoke-WebRequest" |
| 1 | "Invoke-RestMethod" |
| 1 | curl |
| 1 | wget |