Detection rules › Elastic
Windows Installer via Windows Script
Detects attempts to invoke a Windows Installer from a Windows script. Some malware installers use this method to avoid spawning a child process and continue execution via the Windows installer service.
MITRE ATT&CK coverage
Rule body
[rule]
description = """
Detects attempts to invoke a Windows Installer from a Windows script. Some malware installers use this method to avoid
spawning a child process and continue execution via the Windows installer service.
"""
id = "2e9cac0f-84a8-4578-b480-f3716b7db959"
license = "Elastic License v2"
name = "Windows Installer via Windows Script"
os_list = ["windows"]
version = "1.0.3"
query = '''
api where process.Ext.api.name == "AmsiScanBuffer" and process.executable != null and user.id != "S-1-5-18" and
(process.name in~ ("wscript.exe", "cscript.exe", "mshta.exe", "msxsl.exe", "powershell.exe") or
process.Ext.api.parameters.app_name in ("JScript", "VBScript", "PowerShell")) and
(
(process.Ext.api.parameters.buffer : "*ActiveXObject*" and
process.Ext.api.parameters.buffer : ("*.InstallProduct(*", "*.WindowsInstaller.Installer*")) or
(process.Ext.api.parameters.buffer : "*WindowsInstaller*" and
process.Ext.api.parameters.buffer : "*InstallProduct*" and process.Ext.api.parameters.buffer : "*http*")
) and
not process.Ext.api.parameters.content_name : ("?:\\Program Files (x86)\\*", "?:\\Program Files\\*") and
not process.parent.executable :
("?:\\Program Files\\HP\\HP LaserJet Pro *\\Bin\\HP LaserJet Pro *.exe",
"?:\\Program Files (x86)\\Tanium\\Tanium Client\\TaniumClient.exe",
"?:\\Program Files\\System Center Operations Manager\\Gateway\\MonitoringHost.exe",
"?:\\Program Files\\Microsoft Monitoring Agent\\Agent\\MonitoringHost.exe") and
not (process.executable : "C:\\Windows\\LSDeployment\\RemoteDeployment*.exe" and
process.code_signature.subject_name == "Lansweeper NV" and process.code_signature.trusted == true)
'''
min_endpoint_version = "8.16.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.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[[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.007"
name = "Msiexec"
reference = "https://attack.mitre.org/techniques/T1218/007/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.16.0"
Stages and Predicates
Stage 1: api
api where process.Ext.api.name == "AmsiScanBuffer" and process.executable != null and user.id != "S-1-5-18" and
(process.name in~ ("wscript.exe", "cscript.exe", "mshta.exe", "msxsl.exe", "powershell.exe") or
process.Ext.api.parameters.app_name in ("JScript", "VBScript", "PowerShell")) and
(
(process.Ext.api.parameters.buffer : "*ActiveXObject*" and
process.Ext.api.parameters.buffer : ("*.InstallProduct(*", "*.WindowsInstaller.Installer*")) or
(process.Ext.api.parameters.buffer : "*WindowsInstaller*" and
process.Ext.api.parameters.buffer : "*InstallProduct*" and process.Ext.api.parameters.buffer : "*http*")
) and
not process.Ext.api.parameters.content_name : ("?:\\Program Files (x86)\\*", "?:\\Program Files\\*") and
not process.parent.executable :
("?:\\Program Files\\HP\\HP LaserJet Pro *\\Bin\\HP LaserJet Pro *.exe",
"?:\\Program Files (x86)\\Tanium\\Tanium Client\\TaniumClient.exe",
"?:\\Program Files\\System Center Operations Manager\\Gateway\\MonitoringHost.exe",
"?:\\Program Files\\Microsoft Monitoring Agent\\Agent\\MonitoringHost.exe") and
not (process.executable : "C:\\Windows\\LSDeployment\\RemoteDeployment*.exe" and
process.code_signature.subject_name == "Lansweeper NV" and process.code_signature.trusted == true)
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.subject_name | eq | Lansweeper NV | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Lansweeper NV" |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.executable | wildcard | C:\Windows\LSDeployment\RemoteDeployment*.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\LSDeployment\RemoteDeployment*.exe" |
process.Ext.api.parameters.content_name | starts_with | ?:\Program Files (x86)\, ?:\Program Files\ | excludes:process.Ext.api.parameters.content_name field:"process.Ext.api.parameters.content_name" value:"?:\Program Files (x86)\" field:"process.Ext.api.parameters.content_name" value:"?:\Program Files\" |
process.parent.executable | wildcard | ?:\Program Files\HP\HP LaserJet Pro *\Bin\HP LaserJet Pro *.exe, ?:\Program Files (x86)\Tanium\Tanium Client\TaniumClient.exe, ?:\Program Files\System Center Operations Manager\Gateway\MonitoringHost.exe, ?:\Program Files\Microsoft Monitoring Agent\Agent\MonitoringHost.exe | excludes:process.parent.executable |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
process.Ext.api.name | eq |
| field:"process.Ext.api.name" kind:eq value:"AmsiScanBuffer" |
process.Ext.api.parameters.app_name | in |
| field:"process.Ext.api.parameters.app_name" kind:in |
process.Ext.api.parameters.buffer | wildcard |
| field:"process.Ext.api.parameters.buffer" kind:wildcard |
process.executable | is_not_null | field:"Image" kind:is_not_null | |
process.name | in |
| field:"process_name" kind:in |
user.id | ne |
| field:"user.id" kind:ne value:"S-1-5-18" |