Detection rules › Splunk

MSHTA.exe execution (Windows Event Log)

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

Detect use of MSHTA

MITRE ATT&CK coverage

References

Telemetry coverage

Rule body

id: '5982.6332'
title: MSHTA.exe execution
description: 'Detect use of MSHTA. -- Threat Actor Association: Actinium/Gamaredon/Primitive
  Bear, APT37, APT43, FIN7, Kimsuky, MuddyWater, TA551, TA576, UAC-0057 (GhostWriter),
  Wizard Spider -- Software Association: Bazar, Conti, PYSA/Mespinoza, Trickbot, XingLocker,
  Zloader Atomics T1218.005 Test#1 Atomics T1218.005 Test#2 Atomics T1218.005 Test#3
  Atomics T1218.005 Test#4 Atomics T1218.005 Test#5 Atomics T1218.005 Test#6 Atomics
  T1218.005 Test#7 Atomics T1218.005 Test#8 Atomics T1218.005 Test#9 Atomics T1218.005
  Test#10 Atomics T1059.001 Test #9 - #TrendingThreat #Russia #Ukraine'
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=4688) OR
  "<EventID>4688<" OR Type=Process) (TERM(mshta.exe) OR TERM(mshta)) | table _time,
  host, user process, process_*, parent_*, signature_id, src_*, dest_* | bin span=1s
  | stats values(*) as * by _time, host | where match(process_name, "(?i)mshta") OR
  match(process, "(?i)mshta") OR (match(parent_process_name, "(?i)mshta") and match(process_name,
  "(?i)cmd|powershell")) '
techniques:
- defense-evasion:system binary proxy execution:mshta
technique_id:
- T1218.005
data_category:
- Windows event logs
references:
- https://lolbas-project.github.io/lolbas/Binaries/Mshta/
- ired.team/offensive-security/code-execution/t1170-mshta-code-execution
- https://attackiq.com/2020/04/20/fingerprinting-fin7/

Stages and Predicates

Stage 1: search

`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=4688) OR "<EventID>4688<" OR Type=Process) (TERM(mshta.exe) OR TERM(mshta))

Stage 2: table

| table _time, host, user process, process_*, parent_*, signature_id, src_*, dest_*

Stage 3: bucket

| bin span=1s

Stage 4: stats

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

Stage 5: where

| where match(process_name, "(?i)mshta") OR match(process, "(?i)mshta") OR (match(parent_process_name, "(?i)mshta") and match(process_name, "(?i)cmd|powershell"))

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"
parent_process_nameregex_match
  • "(?i)mshta" corpus 3 (splunk 3)
field:"parent_process_name" kind:regex_match
processregex_match
  • "(?i)mshta" corpus 3 (splunk 3)
field:"CommandLine" kind:regex_match
process_nameregex_match
    • "(?i)cmd
    • powershell"
    corpus 3 (splunk 3)
  • "(?i)mshta" corpus 3 (splunk 3)
field:"process_name" kind:regex_match

Search terms

These SPL tokens match against raw event text.

StageTerm
1"<EventID>4688<"
1mshta.exe
1mshta