Detection rules › Splunk

Impacket Lateral Movement Activity (Sysmon)

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

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

id: '33319.58976'
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_sysmon` (TERM(EventCode=1) OR "<EventID>1<")
  ("&1" OR "&1") (("wmiprvse.exe" OR "mmc.exe" OR "explorer.exe" OR "services.exe")
  ("cmd.exe" "/Q" "/c")) OR ("svchost" "-k" "netsvcs" "taskeng.exe" "cmd" "/C" "Windows\\Temp")
  | where (match(parent_process_name, "(?i)(wmiprvse|mmc|explorer|services)\.exe")
  and match(process, "(?i)cmd\.exe\s\/Q\s\/c\s")) or (match(parent_process, "(?i)svchost\.exe\s-k\snetsvcs.+taskeng\.exe")
  and match(process, "(?i)cmd\.exe\s\/c\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:
- Windows Sysmon
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_sysmon` (TERM(EventCode=1) OR "<EventID>1<") ("&1" OR "&1") (("wmiprvse.exe" OR "mmc.exe" OR "explorer.exe" OR "services.exe") ("cmd.exe" "/Q" "/c")) OR ("svchost" "-k" "netsvcs" "taskeng.exe" "cmd" "/C" "Windows\\Temp")

Stage 2: where

| where (match(parent_process_name, "(?i)(wmiprvse|mmc|explorer|services)\.exe") and match(process, "(?i)cmd\.exe\s\/Q\s\/c\s")) or (match(parent_process, "(?i)svchost\.exe\s-k\snetsvcs.+taskeng\.exe") and match(process, "(?i)cmd\.exe\s\/c\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
  • 1 corpus 237 (splunk 224, kusto 13)
parent_processmatch
  • "(?i)svchost\.exe\s-k\snetsvcs.+taskeng\.exe"
parent_process_namematch
  • "(?i)(wmiprvse|mmc|explorer|services)\.exe" corpus 2 (splunk 2)
processmatch
  • "(?i)cmd\.exe\s\/Q\s\/c\s"
  • "(?i)cmd\.exe\s\/c\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>1<"
1"&1"
1"&1"
1"wmiprvse.exe"
1"mmc.exe"
1"explorer.exe"
1"services.exe"
1"cmd.exe"
1"/Q"
1"/c"
1"svchost"
1"-k"
1"netsvcs"
1"taskeng.exe"
1"cmd"
1"/C"
1"Windows\\Temp"