Detection rules › Elastic
Execution via a Suspicious WMI Client
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
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Execution | |
| Stealth |
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.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.Ext.effective_parent.name | eq | excel.exe, powerpnt.exe, winword.exe | excludes: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.args | eq | 1 | excludes:process.args field:"process.args" value:"1" |
process.args | eq | 60 | excludes:process.args field:"process.args" value:"60" |
process.args | eq | C:\Windows\TEMP\RestartHealthService.ps1 | excludes:process.args field:"process.args" value:"C:\Windows\TEMP\RestartHealthService.ps1" |
process.name | eq | powershell.exe | excludes:process.name field:"process.name" value:"powershell.exe" |
process.Ext.effective_parent.name | eq | cscript.exe | excludes:process.Ext.effective_parent.name field:"process.Ext.effective_parent.name" value:"cscript.exe" |
process.args | eq | ?:\Windows\TEMP\RestartHealthService.js | excludes:process.args field:"process.args" value:"?:\Windows\TEMP\RestartHealthService.js" |
user.id | eq | S-1-5-18 | excludes:user.id field:"user.id" value:"S-1-5-18" |
process.args | wildcard | \\*\netlogon\logon.cmd, ?:\ProgramData\Package Cache" %a in (cybereasonsensor.exe)*, (x86)\EOG\iFileMenu\iFileMenu.bat | excludes:process.args |
process.name | eq | cmd.exe | excludes:process.name field:"process.name" value:"cmd.exe" |
process.code_signature.subject_name | eq | Immense Networks LLC, Synology Inc., Xerox Corporation, Beijing Qihu Technology Co., Ltd. | excludes:process.code_signature.subject_name |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.command_line | eq | 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" | excludes:process.command_line |
process.command_line | match | CgAgACAAIAAgAHQAcgBhAHAAIAB7AAoAIAAgACAAIAAgACAAIAAgACQAdwByAGEAcABwAGUAcgBfAHAAYQB0AGgAIAA9ACAAIgAkACgAJABlAG4AdgA6AFQARQBNAFAAKQBcAGEAbgBzAGkAYgBsAGUALQBhAHMAeQBuAGMALQB3AHIAYQBwAHAAZQByAC0AZ | excludes:process.command_line field:"process.command_line" value:"CgAgACAAIAAgAHQAcgBhAHAAIAB7AAoAIAAgACAAIAAgACAAIAAgACQAdwByAGEAcABwAGUAcgBfAHAAYQB0AGgAIAA9ACAAIgAkACgAJABlAG4AdgA6AFQARQBNAFAAKQBcAGEAbgBzAGkAYgBsAGUALQBhAHMAeQBuAGMALQB3AHIAYQBwAHAAZQByAC0AZ" |
process.executable | wildcard | ?:\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 | excludes:process.executable |
process.hash.sha256 | eq | 0e692d9d3342fdcab1ce3d61aed0520989a94371e5898edb266c92f1fe11c97f, 8ee339af3ce1287066881147557dc3b57d1835cbba56b2457663068ed25b7840, f27cb78f44fc8f70606be883bbed705bd1dd2c2f8a84a596e5f4924e19068f22 | excludes: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.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.Ext.effective_parent.executable | wildcard |
| field:"process.Ext.effective_parent.executable" kind:wildcard |
process.Ext.effective_parent.name | wildcard |
| field:"process.Ext.effective_parent.name" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_name" kind:wildcard value:"WmiPrvSE.exe" |