Detection rules › Splunk
Impacket PSexec (Windows Event Log)
Impackets psexec.py enables users to execute commands or gain an interactive shell on a remote host
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | T1569.002 System Services: Service Execution |
| Lateral Movement | T1021 Remote Services |
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: '5398.5498'
title: Impacket PSexec
description: 'Impackets psexec.py enables users to execute commands or gain an interactive
shell on a remote host. -- Threat Actor Association: APT28 (aka.Fancy Bear, Fighting
Ursa, Forest Blizzard, Pawn Storm, TA422, STRONTIUM), Cadet Blizzard, UNC5221, UTA0178
- Software Association: LockBit, Vice Society -- Atomics T1021.002 Test#3'
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=4688) OR
"<EventID>4688<" OR TERM(EventCode=5145) OR "<EventID>5145<")| regex _raw="(?i)(\w{8}\.exe)|(psexec)"
| eval file_name=Relative_Target_Name| where match(parent_process_name, "(?i)(\w{8}\.exe)|(psexec)")
or match(file_name, "(?i)(\w{8}\.exe)|(psexec)") | table _time, host, user signature_id,
user, dest_host, process_id, process_name, process_path, process, parent_process_id,
parent_process_name, parent_process_path, file_name | bin span=10s | stats values(*)
as * by _time, host | where match(signature_id, "4688") and match(signature_id,
"5145") '
techniques:
- execution:system services:service execution
- lateral-movement:remote services
technique_id:
- T1569.002
- T1021
data_category:
- Windows event logs
references:
- https://github.com/SecureAuthCorp/impacket/blob/master/examples/psexec.py
Stages and Predicates
Stage 1: search
`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=4688) OR "<EventID>4688<" OR TERM(EventCode=5145) OR "<EventID>5145<")
Stage 2: regex
| regex _raw="(?i)(\w{8}\.exe)|(psexec)"
Stage 3: eval
| eval file_name=Relative_Target_Name
Stage 4: where
| where match(parent_process_name, "(?i)(\w{8}\.exe)|(psexec)") or match(file_name, "(?i)(\w{8}\.exe)|(psexec)")
Stage 5: table
| table _time, host, user signature_id, user, dest_host, process_id, process_name, process_path, process, parent_process_id, parent_process_name, parent_process_path, file_name
Stage 6: bucket
| bin span=10s
Stage 7: stats
| stats values(*) as * by _time, host
Stage 8: where
| where match(signature_id, "4688") and match(signature_id, "5145")
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 |
|
_raw | regex_match |
|
file_name | match |
|
parent_process_name | match |
|
signature_id | 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<" |