Detection rules › Elastic
Execution via MsiExec DownloadAndExecute CustomAction
Detects attempts to download and execute a file via a Windows Installer CustomAction.
MITRE ATT&CK coverage
Rule body
[rule]
description = "Detects attempts to download and execute a file via a Windows Installer CustomAction."
id = "70c01e6b-bc59-411e-9bf7-6a46e08d953b"
license = "Elastic License v2"
name = "Execution via MsiExec DownloadAndExecute CustomAction"
os_list = ["windows"]
version = "1.0.3"
query = '''
sequence with maxspan=1m
[process where event.action == "start" and process.name : "rundll32.exe" and
process.command_line : "*!CustomActions.DownloadAndExecute*"] by process.entity_id
[dns where event.action == "lookup_requested" and
process.name : "rundll32.exe" and dns.question.name : "?*"] by process.entity_id
[process where event.action == "start" and process.parent.name : "rundll32.exe"] by process.parent.entity_id
'''
min_endpoint_version = "8.10.0"
reputation = true
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 2
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[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.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.10.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id, process.parent.entity_id.
Stage 1: process
[process where event.action == "start" and process.name : "rundll32.exe" and
process.command_line : "*!CustomActions.DownloadAndExecute*"] by process.entity_id
Stage 2: dns
[dns where event.action == "lookup_requested" and
process.name : "rundll32.exe" and dns.question.name : "?*"] by process.entity_id
Stage 3: process
[process where event.action == "start" and process.parent.name : "rundll32.exe"] by process.parent.entity_id
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dns.question.name | wildcard |
| field:"QueryName" kind:wildcard value:"?*" |
event.action | eq |
| field:"EventType" kind:eq |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard value:"*!CustomActions.DownloadAndExecute*" |
process.name | wildcard |
| field:"process_name" kind:wildcard value:"rundll32.exe" |
process.parent.name | wildcard |
| field:"parent_process_name" kind:wildcard value:"rundll32.exe" |