Detection rules › Splunk
Command Output Redirected to Localhost (Windows Event Log)
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
| Tactic | Techniques |
|---|---|
| Execution | T1059 Command and Scripting Interpreter |
| Collection | T1074 Data Staged |
References
Event coverage
| Provider | Event | Title |
|---|---|---|
| Security-Auditing | Event ID 4688 | A new process has been created. |
| Security-Auditing | Event ID 5145 | A network share object was checked to see whether client can be granted desired access. |
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.
| Field | Kind | Values |
|---|---|---|
EventCode | eq |
|
process | match |
|
src_nt_host | match |
|
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.
| Stage | Term |
|---|---|
| 1 | TERM |
| 1 | "<EventID>4688<" |
| 1 | TERM |
| 1 | "<EventID>5145<" |