Detection rules › Elastic

Windows Script Execution via MMC Console File

Time window
1m
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

Identifies attempts to execute a Windows script via a malicious Microsoft Management Console File. Adversaries may use MSC files for execution and evasion.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies attempts to execute a Windows script via a malicious Microsoft Management Console File. Adversaries may use
MSC files for execution and evasion.
"""
id = "5b5926cf-03ad-476b-959c-a0d15cd1efe0"
license = "Elastic License v2"
name = "Windows Script Execution via MMC Console File"
os_list = ["windows"]
reference = ["https://www.elastic.co/security-labs/grimresource"]
version = "1.0.4"

query = '''
sequence by process.entity_id with maxspan=1m
 [process where event.action == "start" and
  process.executable : "?:\\Windows\\System32\\mmc.exe" and process.args : "*.msc" and
  not process.args : ("?:\\Windows\\System32\\*.msc", "?:\\Windows\\SysWOW64\\*.msc", "?:\\Program files\\*.msc", "?:\\Program Files (x86)\\*.msc") and
  not process.parent.executable : ("C:\\Windows\\System32\\ServerManager.exe", "C:\\Program Files (x86)\\Citrix\\System32\\wfshell.exe") and
  not (process.working_directory : "C:\\Windows\\system32\\" and process.command_line : "\"C:\\Windows\\System32\\mmc.exe\" rrasmgmt.msc") and
  not process.parent.executable : "C:\\Program Files\\Devolutions\\Remote Desktop Manager\\RemoteDesktopManager.exe"
  ]
 [file where event.action in ("creation", "overwrite") and
  process.executable :  "?:\\Windows\\System32\\mmc.exe" and
  file.path : "?:\\Users\\*\\AppData\\Local\\Microsoft\\Windows\\INetCache\\IE\\*"]
'''

min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true

[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.005"
name = "Visual Basic"
reference = "https://attack.mitre.org/techniques/T1059/005/"

[[threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[threat.technique.subtechnique]]
id = "T1218.014"
name = "MMC"
reference = "https://attack.mitre.org/techniques/T1218/014/"



[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id.

Stage 1: process

[process where event.action == "start" and
  process.executable : "?:\\Windows\\System32\\mmc.exe" and process.args : "*.msc" and
  not process.args : ("?:\\Windows\\System32\\*.msc", "?:\\Windows\\SysWOW64\\*.msc", "?:\\Program files\\*.msc", "?:\\Program Files (x86)\\*.msc") and
  not process.parent.executable : ("C:\\Windows\\System32\\ServerManager.exe", "C:\\Program Files (x86)\\Citrix\\System32\\wfshell.exe") and
  not (process.working_directory : "C:\\Windows\\system32\\" and process.command_line : "\"C:\\Windows\\System32\\mmc.exe\" rrasmgmt.msc") and
  not process.parent.executable : "C:\\Program Files\\Devolutions\\Remote Desktop Manager\\RemoteDesktopManager.exe"
  ]

Stage 2: file

[file where event.action in ("creation", "overwrite") and
  process.executable :  "?:\\Windows\\System32\\mmc.exe" and
  file.path : "?:\\Users\\*\\AppData\\Local\\Microsoft\\Windows\\INetCache\\IE\\*"]

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.command_lineeq"C:\Windows\System32\mmc.exe" rrasmgmt.mscexcludes:process.command_line
process.working_directoryeqC:\Windows\system32\excludes:process.working_directory field:"process.working_directory" value:"C:\Windows\system32\"
process.argswildcard?:\Windows\System32\*.msc, ?:\Windows\SysWOW64\*.msc, ?:\Program files\*.msc, ?:\Program Files (x86)\*.mscexcludes:process.args
process.parent.executableeqC:\Program Files\Devolutions\Remote Desktop Manager\RemoteDesktopManager.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files\Devolutions\Remote Desktop Manager\RemoteDesktopManager.exe"
process.parent.executableeqC:\Windows\System32\ServerManager.exe, C:\Program Files (x86)\Citrix\System32\wfshell.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\System32\ServerManager.exe" field:"process.parent.executable" value:"C:\Program Files (x86)\Citrix\System32\wfshell.exe"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
event.actionin
  • creation corpus 58 (elastic 58)
  • overwrite corpus 8 (elastic 8)
field:"EventType" kind:in
file.pathwildcard
  • ?:\Users\*\AppData\Local\Microsoft\Windows\INetCache\IE\* corpus 3 (elastic 3)
field:"TargetFilename" kind:wildcard value:"?:\Users\*\AppData\Local\Microsoft\Windows\INetCache\IE\*"
process.argswildcard
  • *.msc corpus 3 (elastic 3)
field:"process.args" kind:wildcard value:"*.msc"
process.executablewildcard
  • ?:\Windows\System32\mmc.exe corpus 2 (elastic 2)
field:"Image" kind:wildcard value:"?:\Windows\System32\mmc.exe"