Detection rules › Splunk

Suspicious Executable by CMD.exe (Sysmon)

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

Detect when an executable has been launched by cmd.exe. Such as spawning powershell.exe, cscript rundll32 and similar processes being a child process of cmd

MITRE ATT&CK coverage

References

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 1: Process creation

Rule body

id: '8823.11629'
title: Suspicious Executable by CMD.exe
description: 'Detect when an executable has been launched by cmd.exe. Such as spawning
  powershell.exe, cscript rundll32 and similar processes being a child process of
  cmd. -- Threat Actor Association: APT28 (aka.Fancy Bear, Fighting Ursa, Forest Blizzard,
  Pawn Storm, TA422, STRONTIUM), APT34/OilRig, APT43, FIN8, Flax Typhoon, REvil, WinterVivern/UAC-0114
  - Software Association: Alchimist, AvosLocker, Black Basta, MagicRAT, Rhysida'
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_sysmon` (TERM(EventCode=1) OR "<EventID>1<")
  "cmd.exe" ("powershell.exe" OR "services.exe" OR "dllhost.exe" OR "rundll32.exe"
  OR "cscript.exe" OR "regsvr32.exe") | regex parent_process_name="(?i)(cmd\.exe)"
  | regex process_path="(?i)((powershell)|(services)|(dllhost)|(rundll32)|(cscript)|(regsvr32))\.exe"
  | table _time, host, user event_id, parent_*, process_*, process, signature_id,
  src_*, dest_* | bin span=1s | stats values(*) as * by _time, host | where isnotnull(user) '
techniques:
- execution:command and scripting interpreter
technique_id: 
- T1059
data_category:
- Windows Sysmon
references:
- https://secure.anvilogic.com/use_cases?id=AVL_UC1041#more_info

Stages and Predicates

Stage 1: search

`get_endpoint_data` `get_endpoint_data_sysmon` (TERM(EventCode=1) OR "<EventID>1<") "cmd.exe" ("powershell.exe" OR "services.exe" OR "dllhost.exe" OR "rundll32.exe" OR "cscript.exe" OR "regsvr32.exe")

Stage 2: regex

| regex parent_process_name="(?i)(cmd\.exe)"

Stage 3: regex

| regex process_path="(?i)((powershell)|(services)|(dllhost)|(rundll32)|(cscript)|(regsvr32))\.exe"

Stage 4: table

| table _time, host, user event_id, parent_*, process_*, process, signature_id, src_*, dest_*

Stage 5: bucket

| bin span=1s

Stage 6: stats

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

Stage 7: where

| where isnotnull(user)

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"
parent_process_nameregex_match
  • "(?i)(cmd.exe)" corpus 2 (splunk 2)
field:"parent_process_name" kind:regex_match
process_pathregex_match
  • "(?i)((powershell)|(services)|(dllhost)|(rundll32)|(cscript)|(regsvr32)).exe"
field:"process_name" kind:regex_match
useris_not_null
  • (no value, null check)
field:"user" kind:is_not_null

Search terms

These SPL tokens match against raw event text.

StageTerm
1"<EventID>1<"
1"cmd.exe"
1"powershell.exe"
1"services.exe"
1"dllhost.exe"
1"rundll32.exe"
1"cscript.exe"
1"regsvr32.exe"