Detection rules › Splunk

WMIC Host Reconniassance (Windows Event Log)

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

WMIC (Windows Management Instrumentation Command-line) reconnaissance involves using the WMIC tool to query system information, configurations, and installed software on Windows systems. Threat actors abuse this feature to gather valuable data about a target environment, which can help them tailor their attacks, escalate privileges, or move laterally across the network. This use case detects WMIC executions with commands that may be used to perform host reconnaissance.

MITRE ATT&CK coverage

References

Telemetry coverage

Rule body

id: '29377.52944'
title: WMIC Host Reconniassance
description: WMIC (Windows Management Instrumentation Command-line) reconnaissance
  involves using the WMIC tool to query system information, configurations, and installed
  software on Windows systems. Threat actors abuse this feature to gather valuable
  data about a target environment, which can help them tailor their attacks, escalate
  privileges, or move laterally across the network. This use case detects WMIC executions
  with commands that may be used to perform host reconnaissance.
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=4688) OR
  "<EventID>4688<" OR Type=Process) ("powershell.exe" OR "cmd.exe" OR "pwsh.exe")
  TERM(wmic) (TERM(os) OR TERM(logicaldisk) OR TERM(share) OR TERM(cpu) OR TERM(memorychip)
  OR TERM(useraccount) OR TERM(nic) OR TERM(startup) OR TERM(service) OR TERM(cpu)
  OR TERM(path) OR TERM(bios) OR TERM(computersystem) OR TERM(product) OR TERM(partition)
  OR TERM(group) OR TERM(environment) OR TERM(diskdrive) OR TERM(qfe) OR TERM(sysdriver)
  OR TERM(namespace) OR TERM(datafile) OR TERM(csproduct) OR TERM(volume)) SubjectUserName!="*$"
  | regex process="(?i)\s(os|logicaldisk|share|cpu|memorychip|useraccount|nic|startup|service|cpu|path|bios|computersystem|product|partition|group|environment|diskdrive|qfe|sysdriver|namespace|datafile|csproduct|volume)"
  | table _time, host, user, process, process_name, parent_process_name, user | bin
  span=1s | stats values(*) as * by _time, host '
techniques:
- discovery:system information discovery
- execution:windows management instrumentation
technique_id: 
- T1082
- T1047
data_category:
- Process command-line parameters
- Windows event logs
references:
- https://cyble.com/blog/aurora-a-stealer-using-shapeshifting-tactics/
- 'https://trustedsec.com/blog/wmi-for-script-kiddies '
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1047/T1047.md
- https://attack.mitre.org/techniques/T1047/

Stages and Predicates

Stage 1: search

`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=4688) OR "<EventID>4688<" OR Type=Process) ("powershell.exe" OR "cmd.exe" OR "pwsh.exe") TERM(wmic) (TERM(os) OR TERM(logicaldisk) OR TERM(share) OR TERM(cpu) OR TERM(memorychip) OR TERM(useraccount) OR TERM(nic) OR TERM(startup) OR TERM(service) OR TERM(cpu) OR TERM(path) OR TERM(bios) OR TERM(computersystem) OR TERM(product) OR TERM(partition) OR TERM(group) OR TERM(environment) OR TERM(diskdrive) OR TERM(qfe) OR TERM(sysdriver) OR TERM(namespace) OR TERM(datafile) OR TERM(csproduct) OR TERM(volume)) SubjectUserName!="*$"

Stage 2: regex

| regex process="(?i)\s(os|logicaldisk|share|cpu|memorychip|useraccount|nic|startup|service|cpu|path|bios|computersystem|product|partition|group|environment|diskdrive|qfe|sysdriver|namespace|datafile|csproduct|volume)"

Stage 3: table

| table _time, host, user, process, process_name, parent_process_name, user

Stage 4: bucket

| bin span=1s

Stage 5: stats

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

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
EventCodeeq
  • 4688 corpus 317 (splunk 283, kusto 33, elastic 1)
field:"EventID" kind:eq value:"4688"
SubjectUserNamene
  • "*$"
field:"SubjectUserName" kind:ne
processregex_match
  • "(?i)\s(os|logicaldisk|share|cpu|memorychip|useraccount|nic|startup|service|cpu|path|bios|computersystem|product|partition|group|environment|diskdrive|qfe|sysdriver|namespace|datafile|csproduct|volume)" corpus 3 (splunk 3)
field:"CommandLine" kind:regex_match

Search terms

These SPL tokens match against raw event text.

StageTerm
1"<EventID>4688<"
1"powershell.exe"
1"cmd.exe"
1"pwsh.exe"
1wmic
1os
1logicaldisk
1share
1cpu
1memorychip
1useraccount
1nic
1startup
1service
1cpu
1path
1bios
1computersystem
1product
1partition
1group
1environment
1diskdrive
1qfe
1sysdriver
1namespace
1datafile
1csproduct
1volume