Detection rules › Splunk

Invoke-WebRequest Command (PowerShell)

Group by
_time, host
Source
github.com/anvilogic-forge/armory

Detects when typical download commands are executed

MITRE ATT&CK coverage

Event coverage

Rule body yaml

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: eval

| 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

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
EventCodeeq
  • 4103 corpus 105 (splunk 105)
  • 4104 corpus 268 (splunk 268)
cmdis_not_null
  • (no value, null check)

Search terms

Bare-string tokens in the SPL search body. Splunk matches each token against _raw (the untyped raw event text) anywhere it appears, not against a specific field. These don't surface in the Indicators table because they aren't predicates on a known field.

StageTerm
1TERM
1IWR
1"Invoke-WebRequest"
1"Invoke-RestMethod"
1TERM
1curl
1TERM
1wget