Detection rules › Elastic

Potential Remote Execution via IMsiServer

Time window
5s
Sequence by
source.ip
Source
github.com/elastic/protections-artifacts

Identifies potential attempts to abuse the IMsiServer Component Object Model (COM) interface to start a remote instance of the msiexec.exe service for lateral movement.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies potential attempts to abuse the IMsiServer Component Object Model (COM) interface to start a remote instance
of the msiexec.exe service for lateral movement.
"""
id = "40696acd-67c8-473e-a8ee-9ade3506d141"
license = "Elastic License v2"
name = "Potential Remote Execution via IMsiServer"
os_list = ["windows"]
reference = ["https://www.deepinstinct.com/blog/forget-psexec-dcom-upload-execute-backdoor"]
version = "1.0.3"

query = '''
sequence by source.ip with maxspan=5s
 [authentication where event.action == "log_on" and process.Ext.session_info.logon_type == "Network" and
  (user.effective.id != null and user.effective.id like ("S-1-5-21*", "S-1-12-*"))]
 [network where event.action in ("connection_accepted", "disconnect_received") and process.name == "msiexec.exe" and
  source.port >= 49152 and destination.port >= 49152 and not cidrmatch(source.ip, "127.0.0.0/8", "::1")]
'''

min_endpoint_version = "8.15.1"
[[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 = "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/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"


[threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"

[internal]
min_endpoint_version = "8.15.1"

Stages and Predicates

Ordered sequence: each step below must occur in order within 5s, correlated by source.ip.

Stage 1: authentication

[authentication where event.action == "log_on" and process.Ext.session_info.logon_type == "Network" and
  (user.effective.id != null and user.effective.id like ("S-1-5-21*", "S-1-12-*"))]

Stage 2: network

[network where event.action in ("connection_accepted", "disconnect_received") and process.name == "msiexec.exe" and
  source.port >= 49152 and destination.port >= 49152 and not cidrmatch(source.ip, "127.0.0.0/8", "::1")]

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
source.ipcidr_match127.0.0.0/8, ::1excludes:source.ip field:"source.ip" value:"127.0.0.0/8" field:"source.ip" value:"::1"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
destination.portge
  • 49152 transforms: number corpus 4 (elastic 4)
field:"DestinationPort" kind:ge value:"49152"
event.actioneq
  • log_on corpus 8 (elastic 8)
field:"EventType" kind:eq value:"log_on"
event.actionin
  • connection_accepted corpus 6 (elastic 6)
  • disconnect_received corpus 2 (elastic 2)
field:"EventType" kind:in
process.Ext.session_info.logon_typeeq
  • Network corpus 4 (elastic 4)
field:"process.Ext.session_info.logon_type" kind:eq value:"Network"
process.nameeq
  • msiexec.exe corpus 46 (elastic 41, splunk 5)
field:"process_name" kind:eq value:"msiexec.exe"
source.portge
  • 49152 transforms: number corpus 16 (elastic 16)
field:"SourcePort" kind:ge value:"49152"
user.effective.idis_not_null
  • (no value, null check)
field:"user.effective.id" kind:is_not_null
user.effective.idwildcard
  • S-1-12-* corpus 4 (elastic 4)
  • S-1-5-21* corpus 4 (elastic 4)
field:"user.effective.id" kind:wildcard