Detection rules › Splunk

Invoke-WebRequest Command (Sysmon)

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

Detects when typical download commands are executed

MITRE ATT&CK coverage

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 1: Process creation

Rule body

id: '5443.5690'
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_sysmon` EventCode=1 (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, signature_id, process, process_*,
  parent_process, parent_process_*, uri | bin span=1s | stats values(*) as * by _time,
  host, process '
techniques:
- execution:command and scripting interpreter:powershell
- command-and-control:ingress tool transfer
technique_id:
- T1059.001
- T1105
data_category:
- Windows Sysmon
references: null

Stages and Predicates

Stage 1: search

`get_endpoint_data` `get_endpoint_data_sysmon` EventCode=1 (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\/\_\+\-\%\.\:]+")

The parser skipped this rex command.

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, signature_id, process, process_*, parent_process, parent_process_*, uri

Stage 6: bucket

| bin span=1s

Stage 7: stats

| stats values(*) as * by _time, host, process

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
EventCodeeq
  • 1 corpus 241 (splunk 225, kusto 15, elastic 1)
field:"EventID" kind:eq value:"1"
cmdis_not_null
  • (no value, null check)
field:"cmd" kind:is_not_null

Search terms

These SPL tokens match against raw event text.

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