Detection rules › Elastic

Execution via a Suspicious WMI Client

Source
github.com/elastic/protections-artifacts

Identifies the execution of a process via Windows Management Instrumentation (WMI) and with an unusual effective parent. Adversaries may abuse Windows Management Instrumentation (WMI) to execute malicious commands and payloads.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the execution of a process via Windows Management Instrumentation (WMI) and with an unusual effective parent.
Adversaries may abuse Windows Management Instrumentation (WMI) to execute malicious commands and payloads.
"""
id = "b0a0d293-f85e-4994-97e6-95541c0bc181"
license = "Elastic License v2"
name = "Execution via a Suspicious WMI Client"
os_list = ["windows"]
reference = ["https://www.elastic.co/security-labs/spring-cleaning-with-latrodectus"]
version = "1.0.33"

query = '''
process where event.action == "start" and
  process.parent.name :"WmiPrvSE.exe" and
   (
    process.Ext.effective_parent.name : ("excel.exe", "powerpnt.exe", "winword.exe", "mshta.exe",
                                         "wscript.exe", "rundll32.exe", "regsvr32.exe",
                                         "msbuild.exe", "InstallUtil.exe") or
    process.Ext.effective_parent.executable : ("?:\\Users\\Public\\*", "?:\\ProgramData\\*", "?:\\Users\\*\\AppData\\*", "?:\\Windows\\Microsoft.NET\\*")
    ) and 
  not (user.id : "S-1-5-18" and process.name : "powershell.exe") and
  not process.hash.sha256 : 
             ("0e692d9d3342fdcab1ce3d61aed0520989a94371e5898edb266c92f1fe11c97f", 
              "8ee339af3ce1287066881147557dc3b57d1835cbba56b2457663068ed25b7840", 
              "f27cb78f44fc8f70606be883bbed705bd1dd2c2f8a84a596e5f4924e19068f22") and
  not (process.name : "powershell.exe" and process.args : "C:\\Windows\\TEMP\\RestartHealthService.ps1" and
       process.args : "60" and process.args : "1" and
       not process.Ext.effective_parent.name : ("excel.exe", "powerpnt.exe", "winword.exe")) and

  not (process.code_signature.subject_name : ("Immense Networks LLC", "Synology Inc.", "Xerox Corporation", "Beijing Qihu Technology Co., Ltd.") and
       process.code_signature.trusted == true) and

  not (process.args : "?:\\Windows\\TEMP\\RestartHealthService.js" and process.args : "60" and user.id : "S-1-5-18" and
       process.Ext.effective_parent.name : "cscript.exe") and

  /* ansible */
  not (process.name : "powershell.exe" and
       process.command_line : "*CgAgACAAIAAgAHQAcgBhAHAAIAB7AAoAIAAgACAAIAAgACAAIAAgACQAdwByAGEAcABwAGUAcgBfAHAAYQB0AGgAIAA9ACAAIgAkACgAJABlAG4AdgA6AFQARQBNAFAAKQBcAGEAbgBzAGkAYgBsAGUALQBhAHMAeQBuAGMALQB3AHIAYQBwAHAAZQByAC0AZ*") and

  not (process.name : "powershell.exe" and
       process.command_line : ("powershell.exe -WindowStyle \"Hidden\" -Command \"Enable-PSRemoting -Force\"",
                               "powershell.exe -WindowStyle \"Hidden\" -Command \"Set-WSManQuickConfig -Force\"",
                               "powershell.exe -WindowStyle \"Hidden\" -Command \"WinRM QuickConfig -Quiet -Force\"")) and
  not process.executable :
             ("?:\\Windows\\System32\\WerFault.exe",
              "?:\\Windows\\SysWOW64\\WerFault.exe",
              "?:\\Windows\\System32\\typeperf.exe",
              "?:\\Program Files*\\Adobe\\Acrobat DC\\Acrobat\\AcroTray.exe",
              "?:\\Program Files*\\Google\\Chrome\\Application\\chrome.exe",
              "?:\\Program Files*\\Mozilla Firefox\\firefox.exe",
              "\\Device\\Mup\\*.exe") and
  not (process.name : "cmd.exe" and
       process.args : ("\\\\*\\netlogon\\logon.cmd",
                       "?:\\ProgramData\\Package Cache\" %a in (cybereasonsensor.exe)*",
                       "(x86)\\EOG\\iFileMenu\\iFileMenu.bat"))
'''

min_endpoint_version = "8.4.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1566"
name = "Phishing"
reference = "https://attack.mitre.org/techniques/T1566/"
[[threat.technique.subtechnique]]
id = "T1566.001"
name = "Spearphishing Attachment"
reference = "https://attack.mitre.org/techniques/T1566/001/"



[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1047"
name = "Windows Management Instrumentation"
reference = "https://attack.mitre.org/techniques/T1047/"


[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.004"
name = "InstallUtil"
reference = "https://attack.mitre.org/techniques/T1218/004/"

[[threat.technique.subtechnique]]
id = "T1218.005"
name = "Mshta"
reference = "https://attack.mitre.org/techniques/T1218/005/"

[[threat.technique.subtechnique]]
id = "T1218.009"
name = "Regsvcs/Regasm"
reference = "https://attack.mitre.org/techniques/T1218/009/"

[[threat.technique.subtechnique]]
id = "T1218.010"
name = "Regsvr32"
reference = "https://attack.mitre.org/techniques/T1218/010/"

[[threat.technique.subtechnique]]
id = "T1218.011"
name = "Rundll32"
reference = "https://attack.mitre.org/techniques/T1218/011/"



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

[internal]
min_endpoint_version = "8.4.0"

Stages and Predicates

Stage 1: process

process where event.action == "start" and
  process.parent.name :"WmiPrvSE.exe" and
   (
    process.Ext.effective_parent.name : ("excel.exe", "powerpnt.exe", "winword.exe", "mshta.exe",
                                         "wscript.exe", "rundll32.exe", "regsvr32.exe",
                                         "msbuild.exe", "InstallUtil.exe") or
    process.Ext.effective_parent.executable : ("?:\\Users\\Public\\*", "?:\\ProgramData\\*", "?:\\Users\\*\\AppData\\*", "?:\\Windows\\Microsoft.NET\\*")
    ) and
  not (user.id : "S-1-5-18" and process.name : "powershell.exe") and
  not process.hash.sha256 :
             ("0e692d9d3342fdcab1ce3d61aed0520989a94371e5898edb266c92f1fe11c97f",
              "8ee339af3ce1287066881147557dc3b57d1835cbba56b2457663068ed25b7840",
              "f27cb78f44fc8f70606be883bbed705bd1dd2c2f8a84a596e5f4924e19068f22") and
  not (process.name : "powershell.exe" and process.args : "C:\\Windows\\TEMP\\RestartHealthService.ps1" and
       process.args : "60" and process.args : "1" and
       not process.Ext.effective_parent.name : ("excel.exe", "powerpnt.exe", "winword.exe")) and
  not (process.code_signature.subject_name : ("Immense Networks LLC", "Synology Inc.", "Xerox Corporation", "Beijing Qihu Technology Co., Ltd.") and
       process.code_signature.trusted == true) and
  not (process.args : "?:\\Windows\\TEMP\\RestartHealthService.js" and process.args : "60" and user.id : "S-1-5-18" and
       process.Ext.effective_parent.name : "cscript.exe") and
  not (process.name : "powershell.exe" and
       process.command_line : "*CgAgACAAIAAgAHQAcgBhAHAAIAB7AAoAIAAgACAAIAAgACAAIAAgACQAdwByAGEAcABwAGUAcgBfAHAAYQB0AGgAIAA9ACAAIgAkACgAJABlAG4AdgA6AFQARQBNAFAAKQBcAGEAbgBzAGkAYgBsAGUALQBhAHMAeQBuAGMALQB3AHIAYQBwAHAAZQByAC0AZ*") and
  not (process.name : "powershell.exe" and
       process.command_line : ("powershell.exe -WindowStyle \"Hidden\" -Command \"Enable-PSRemoting -Force\"",
                               "powershell.exe -WindowStyle \"Hidden\" -Command \"Set-WSManQuickConfig -Force\"",
                               "powershell.exe -WindowStyle \"Hidden\" -Command \"WinRM QuickConfig -Quiet -Force\"")) and
  not process.executable :
             ("?:\\Windows\\System32\\WerFault.exe",
              "?:\\Windows\\SysWOW64\\WerFault.exe",
              "?:\\Windows\\System32\\typeperf.exe",
              "?:\\Program Files*\\Adobe\\Acrobat DC\\Acrobat\\AcroTray.exe",
              "?:\\Program Files*\\Google\\Chrome\\Application\\chrome.exe",
              "?:\\Program Files*\\Mozilla Firefox\\firefox.exe",
              "\\Device\\Mup\\*.exe") and
  not (process.name : "cmd.exe" and
       process.args : ("\\\\*\\netlogon\\logon.cmd",
                       "?:\\ProgramData\\Package Cache\" %a in (cybereasonsensor.exe)*",
                       "(x86)\\EOG\\iFileMenu\\iFileMenu.bat"))

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.Ext.effective_parent.nameeqexcel.exe, powerpnt.exe, winword.exeexcludes:process.Ext.effective_parent.name field:"process.Ext.effective_parent.name" value:"excel.exe" field:"process.Ext.effective_parent.name" value:"powerpnt.exe" field:"process.Ext.effective_parent.name" value:"winword.exe"
process.argseq1excludes:process.args field:"process.args" value:"1"
process.argseq60excludes:process.args field:"process.args" value:"60"
process.argseqC:\Windows\TEMP\RestartHealthService.ps1excludes:process.args field:"process.args" value:"C:\Windows\TEMP\RestartHealthService.ps1"
process.nameeqpowershell.exeexcludes:process.name field:"process.name" value:"powershell.exe"
process.Ext.effective_parent.nameeqcscript.exeexcludes:process.Ext.effective_parent.name field:"process.Ext.effective_parent.name" value:"cscript.exe"
process.argseq?:\Windows\TEMP\RestartHealthService.jsexcludes:process.args field:"process.args" value:"?:\Windows\TEMP\RestartHealthService.js"
user.ideqS-1-5-18excludes:user.id field:"user.id" value:"S-1-5-18"
process.argswildcard\\*\netlogon\logon.cmd, ?:\ProgramData\Package Cache" %a in (cybereasonsensor.exe)*, (x86)\EOG\iFileMenu\iFileMenu.batexcludes:process.args
process.nameeqcmd.exeexcludes:process.name field:"process.name" value:"cmd.exe"
process.code_signature.subject_nameeqImmense Networks LLC, Synology Inc., Xerox Corporation, Beijing Qihu Technology Co., Ltd.excludes:process.code_signature.subject_name
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.command_lineeqpowershell.exe -WindowStyle "Hidden" -Command "Enable-PSRemoting -Force", powershell.exe -WindowStyle "Hidden" -Command "Set-WSManQuickConfig -Force", powershell.exe -WindowStyle "Hidden" -Command "WinRM QuickConfig -Quiet -Force"excludes:process.command_line
process.command_linematchCgAgACAAIAAgAHQAcgBhAHAAIAB7AAoAIAAgACAAIAAgACAAIAAgACQAdwByAGEAcABwAGUAcgBfAHAAYQB0AGgAIAA9ACAAIgAkACgAJABlAG4AdgA6AFQARQBNAFAAKQBcAGEAbgBzAGkAYgBsAGUALQBhAHMAeQBuAGMALQB3AHIAYQBwAHAAZQByAC0AZexcludes:process.command_line field:"process.command_line" value:"CgAgACAAIAAgAHQAcgBhAHAAIAB7AAoAIAAgACAAIAAgACAAIAAgACQAdwByAGEAcABwAGUAcgBfAHAAYQB0AGgAIAA9ACAAIgAkACgAJABlAG4AdgA6AFQARQBNAFAAKQBcAGEAbgBzAGkAYgBsAGUALQBhAHMAeQBuAGMALQB3AHIAYQBwAHAAZQByAC0AZ"
process.executablewildcard?:\Windows\System32\WerFault.exe, ?:\Windows\SysWOW64\WerFault.exe, ?:\Windows\System32\typeperf.exe, ?:\Program Files*\Adobe\Acrobat DC\Acrobat\AcroTray.exe, ?:\Program Files*\Google\Chrome\Application\chrome.exe, ?:\Program Files*\Mozilla Firefox\firefox.exe, \Device\Mup\*.exeexcludes:process.executable
process.hash.sha256eq0e692d9d3342fdcab1ce3d61aed0520989a94371e5898edb266c92f1fe11c97f, 8ee339af3ce1287066881147557dc3b57d1835cbba56b2457663068ed25b7840, f27cb78f44fc8f70606be883bbed705bd1dd2c2f8a84a596e5f4924e19068f22excludes:process.hash.sha256 field:"process.hash.sha256" value:"0e692d9d3342fdcab1ce3d61aed0520989a94371e5898edb266c92f1fe11c97f" field:"process.hash.sha256" value:"8ee339af3ce1287066881147557dc3b57d1835cbba56b2457663068ed25b7840" field:"process.hash.sha256" value:"f27cb78f44fc8f70606be883bbed705bd1dd2c2f8a84a596e5f4924e19068f22"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
process.Ext.effective_parent.executablewildcard
  • ?:\ProgramData\*
  • ?:\Users\*\AppData\*
  • ?:\Users\Public\*
  • ?:\Windows\Microsoft.NET\*
field:"process.Ext.effective_parent.executable" kind:wildcard
process.Ext.effective_parent.namewildcard
  • InstallUtil.exe corpus 2 (elastic 2)
  • excel.exe corpus 2 (elastic 2)
  • msbuild.exe corpus 2 (elastic 2)
  • mshta.exe corpus 2 (elastic 2)
  • powerpnt.exe corpus 2 (elastic 2)
  • regsvr32.exe corpus 2 (elastic 2)
  • rundll32.exe corpus 2 (elastic 2)
  • winword.exe corpus 2 (elastic 2)
  • wscript.exe corpus 2 (elastic 2)
field:"process.Ext.effective_parent.name" kind:wildcard
process.parent.namewildcard
  • WmiPrvSE.exe corpus 25 (elastic 19, splunk 5, kusto 1)
field:"parent_process_name" kind:wildcard value:"WmiPrvSE.exe"