Detection rules › Splunk

Impacket PSexec (Windows Event Log)

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

Impackets psexec.py enables users to execute commands or gain an interactive shell on a remote host

MITRE ATT&CK coverage

References

Event coverage

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.

FieldKindValues
EventCodeeq
  • 4688 corpus 313 (splunk 283, kusto 30)
  • 5145 corpus 18 (splunk 16, kusto 2)
_rawregex_match
    • "(?i)(\w{8}.exe)
    • (psexec)"
file_namematch
  • "(?i)(\w{8}\.exe)|(psexec)"
parent_process_namematch
  • "(?i)(\w{8}\.exe)|(psexec)"
signature_idmatch
  • "4688" corpus 8 (splunk 8)
  • "5145" corpus 2 (splunk 2)

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<"