Detection rules › Splunk

Impacket Lateral Movement Activity (Windows Event Log)

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

Impacket is a collection of Python classes for working with network protocols, primarily focused on providing tools and scripts that facilitate the interaction with network services and protocols commonly used in network penetration testing and red teaming. wmiexec, smbexec, and dcomexec are specific tools within the Impacket suite that use various protocols to execute commands on remote systems. This use case detects specific behavior patterns associated with Impacket tools wmiexec, smbexec, and dcomexec.

MITRE ATT&CK coverage

References

Event coverage

Rule body yaml

id: '33319.58975'
title: Impacket Lateral Movement Activity
description: Impacket is a collection of Python classes for working with network protocols,
  primarily focused on providing tools and scripts that facilitate the interaction
  with network services and protocols commonly used in network penetration testing
  and red teaming. wmiexec, smbexec, and dcomexec are specific tools within the Impacket
  suite that use various protocols to execute commands on remote systems. This use
  case detects specific behavior patterns associated with Impacket tools wmiexec,
  smbexec, and dcomexec.
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=4688) OR
  "<EventID>4688<" OR Type=Process) ("&1" OR "&1") (("wmiprvse.exe" OR "mmc.exe"
  OR "explorer.exe" OR "services.exe") (("cmd.exe" OR "powershell.exe" OR "pwsh.exe")
  ("/Q" "/c") OR ("-c" OR "-command"))) OR ("svchost" ("cmd" OR "powershell" OR "pwsh")
  ("/C" OR -c" OR -command") "Windows\\Temp") | where ((match(parent_process_name,
  "(?i)(wmiprvse|mmc|explorer|services)\.exe") and match(process, "(?i)(cmd|powershell|pwsh)\.exe\s(\/Q)?\s(\/|-)c(ommand)?\s"))
  or (match(parent_process_name, "(?i)svchost\.exe") and match(process, "(?i)(powershell|pwsh|cmd)\.exe\s(\/|-)c(ommand)?\s.+Windows\x5cTemp\x5c")))
  | table _time, host, user, parent_*, process, process_* | bin span=1s | stats values(*)
  as * by _time, host '
techniques:
- lateral-movement:remote services:smb/windows admin shares
- lateral-movement:exploitation of remote services
technique_id:
- T1021.002
- T1210
data_category:
- Process command-line parameters
- Windows event logs
references:
- https://attack.mitre.org/techniques/T1047/
- https://attack.mitre.org/techniques/T1021/003/
- https://detection.fyi/sigmahq/sigma/windows/process_creation/proc_creation_win_hktl_impacket_lateral_movement/?query=10c14723-61c7-4c75-92ca-9af245723ad2
- https://github.com/fortra/impacket/tree/master

Stages and Predicates

Stage 1: search

`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=4688) OR "<EventID>4688<" OR Type=Process) ("&1" OR "&1") (("wmiprvse.exe" OR "mmc.exe" OR "explorer.exe" OR "services.exe") (("cmd.exe" OR "powershell.exe" OR "pwsh.exe") ("/Q" "/c") OR ("-c" OR "-command"))) OR ("svchost" ("cmd" OR "powershell" OR "pwsh") ("/C" OR -c" OR -command") "Windows\\Temp")

Stage 2: where

| where ((match(parent_process_name, "(?i)(wmiprvse|mmc|explorer|services)\.exe") and match(process, "(?i)(cmd|powershell|pwsh)\.exe\s(\/Q)?\s(\/|-)c(ommand)?\s")) or (match(parent_process_name, "(?i)svchost\.exe") and match(process, "(?i)(powershell|pwsh|cmd)\.exe\s(\/|-)c(ommand)?\s.+Windows\x5cTemp\x5c")))

Stage 3: table

| table _time, host, user, parent_*, process, process_*

Stage 4: bucket

| bin span=1s

Stage 5: stats

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

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)
parent_process_namematch
  • "(?i)(wmiprvse|mmc|explorer|services)\.exe" corpus 2 (splunk 2)
  • "(?i)svchost\.exe"
processmatch
  • "(?i)(cmd|powershell|pwsh)\.exe\s(\/Q)?\s(\/|-)c(ommand)?\s"
  • "(?i)(powershell|pwsh|cmd)\.exe\s(\/|-)c(ommand)?\s.+Windows\x5cTemp\x5c"

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<"
1"&1"
1"&1"
1"wmiprvse.exe"
1"mmc.exe"
1"explorer.exe"
1"services.exe"
1"cmd.exe"
1"powershell.exe"
1"pwsh.exe"
1"/Q"
1"/c"
1"-c"
1"-command"
1"svchost"
1"cmd"
1"powershell"
1"pwsh"
1"/C"
1-c"
1-command"
1"Windows\\Temp"