Detection rules › Splunk

Command Output Redirected to Localhost (Windows Event Log)

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

Command output redirection to localhost is a consistent behavior for post-exploitation frameworks and is commonly observed in red team engagements

MITRE ATT&CK coverage

References

Event coverage

Rule body yaml

id: '15682.23295'
title: Command Output Redirected to Localhost
description: 'Command output redirection to localhost is a consistent behavior for
  post-exploitation frameworks and is commonly observed in red team engagements. --
  Threat Actor Association: Mustang Panda (aka. Stately Taurus//Earth Preta/BRONZE
  PRESIDENT/TA416/RedDelta)'
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=4688) OR
  "<EventID>4688<" OR Type=Process OR TERM(EventCode=5145) OR "<EventID>5145<") |
  rex field=_raw "''ShareName''?>(?<share_name>[^<]+)" | table _time, host, user signature_id,
  process, process_*, src_nt_host, share_name | bin span=1s | stats values(*) as *
  by _time, host | where match(process, "(?i)cmd(\.exe)?.*\s+/c\s+") and match(src_nt_host,
  "127.0.0.1") '
techniques:
- collection:data staged
- execution:command and scripting interpreter
technique_id: 
- T1074
- T1059
data_category:
- Windows event logs
- Process command-line parameters
references:
- https://resource.redcanary.com/rs/003-YRU-314/images/2021-Threat-Detection-Report.pdf

Stages and Predicates

Stage 1: search

`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=4688) OR "<EventID>4688<" OR Type=Process OR TERM(EventCode=5145) OR "<EventID>5145<")

Stage 2: rex

| rex field=_raw "'ShareName'?>(?<share_name>[^<]+)"

Stage 3: table

| table _time, host, user signature_id, process, process_*, src_nt_host, share_name

Stage 4: bucket

| bin span=1s

Stage 5: stats

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

Stage 6: where

| where match(process, "(?i)cmd(\.exe)?.*\s+/c\s+") and match(src_nt_host, "127.0.0.1")

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
  • 4688 corpus 313 (splunk 283, kusto 30)
  • 5145 corpus 18 (splunk 16, kusto 2)
processmatch
  • "(?i)cmd(\.exe)?.*\s+/c\s+"
src_nt_hostmatch
  • "127.0.0.1"

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
1"<EventID>4688<"
1TERM
1"<EventID>5145<"