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 | |
| Lateral Movement |
References
Telemetry coverage
Rule body
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
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
EventCode | eq |
| field:"EventID" kind:eq |
_raw | regex_match |
| field:"_raw" kind:regex_match |
file_name | regex_match |
| field:"file_name" kind:regex_match |
parent_process_name | regex_match |
| field:"parent_process_name" kind:regex_match |
signature_id | regex_match |
| field:"signature_id" kind:regex_match |
Search terms
These SPL tokens match against raw event text.
| Stage | Term |
|---|---|
| 1 | "<EventID>4688<" |
| 1 | "<EventID>5145<" |