Detection rules › Elastic

Remote File Execution via MSIEXEC

Time window
1m
Source
github.com/elastic/protections-artifacts

Identifies the execution of the built-in Windows Installer, MSIEXEC, with a url in the command line. Adversaries may abuse msiexec.exe to launch local or network accessible MSI files.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the execution of the built-in Windows Installer, MSIEXEC, with a url in the command line. Adversaries may
abuse msiexec.exe to launch local or network accessible MSI files.
"""
id = "8ba98e28-d83e-451e-8df7-f0964f7e69b6"
license = "Elastic License v2"
name = "Remote File Execution via MSIEXEC"
os_list = ["windows"]
reference = [
    "https://lolbas-project.github.io/lolbas/Binaries/Msiexec/",
    "https://lolbas-project.github.io/lolbas/OtherMSBinaries/Devinit/",
    "https://www.elastic.co/security-labs/spring-cleaning-with-latrodectus",
    "https://www.guardicore.com/labs/purple-fox-rootkit-now-propagates-as-a-worm/",
]
version = "1.0.47"

query = '''
sequence with maxspan=1m
[process where event.action == "start" and
 (
 ((process.pe.original_file_name : "devinit.dll" or process.name : "devinit.exe") and
   process.args : "msi-install" and process.command_line : "*http*") or

 (process.name : "msiexec.exe" and process.args :("/i", "-i") and
  process.args : ("/q", "-q", "/qn", "-qn") and process.args : "\\\\*@*\\*.msi") or

 (process.name : "msiexec.exe" and process.args : ("-PaCKagE", "/PaCKagE", "-fv") and
  process.args : ("/qn", "-qn", "-q", "/q", "/quiet") and process.command_line : "*http*") or

 (process.name : "msiexec.exe" and process.args :("/i", "-i") and
  process.args : ("/qn", "-qn", "-q", "/q") and
  process.command_line : ("*transforms*http:*", "*transforms*https:*", "*http*INSTALLDIR=%LOCALAPPDATA%*") and
  not process.parent.executable : ("D:\\Visma\\Install\\FDN\\PIN\\Client\\Base\\SW\\24200\\PublicInstallerNextGen.exe",
                                   "C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\Updates\\AgentUpgrader.exe"))  or

 (process.name : "powershell.exe" and process.command_line : "*WindowsInstaller*" and
  process.command_line : "*http*" and process.command_line : "*InstallProduct*")  or

 (process.name : "msiexec.exe" and
  process.parent.name : ("explorer.exe", "python.exe") and process.args : ("/i", "-i") and
  process.command_line : "*http*") or

 ((process.pe.original_file_name : "msiexec.exe" or process.name : "msiexec.exe") and
  process.command_line : "*http*" and process.args_count <= 5 and
  (
   (process.args : ("/i", "-i") and process.args : ("/q", "/quiet", "/qn", "-q", "-quiet", "-qn", "-Q+")) or
   process.args : ("*-Q-I*", "*-I-Q*", "*/q-i*", "*-q/i*", "*/q/i*") or
   (process.parent.name : "cmd.exe" and process.parent.args : "/v/r*")
   )
    and
  not descendant of
       [process where event.action == "start" and process.name : "*setup*" and process.code_signature.trusted == true] and
  not process.Ext.token.integrity_level_name == "system")
) and
not process.args :
          ("https://download.microsoft.com/download/*.msi",
           "APIURL=http*",
           "TRANSFORMS=C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\\\Updates\\UEMSAgent.mst",
           "SERVERNAME=*.manageengine.com", 
           "C:\\Program Files (x86)\\ManageEngine\\UEMS_DistributionServer\\\\Updates\\UEMSDistributionServer.msi",
           "https://awscli.amazonaws.com/AWSCLIV2.msi",
           "SERVERURL=https://*.apparmor.com",
           "INSTALLARGS=--url=https://*.fleet.us-east-2.aws.elastic-cloud.com:443*",
           "https://cdn.zabbix.com/zabbix/binaries/stable/*.msi",
           "INSTALLARGS=--url=https://*--enrollment-token=*",
           "C:\\WINDOWS\\_ScriptingFramework\\Logs\\Software\\*.log",
           "?:\\*\\http*.msi",
           "C:\\WINDOWS\\ccmcache\\*.msi",
           "C:\\Windows\\Temp\\*.msi",
           "\\\\*\\NETLOGON\\*.msi") and
not process.parent.executable :
                     ("C:\\Program Files (x86)\\Novell\\ZENworks\\bin\\ZenworksWindowsService.exe",
                      "C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\Updates\\AgentUpgrader.exe",
                      "C:\\Program Files (x86)\\FastTrack Software\\Admin By Request\\AdminByRequest.exe") and
not process.executable : "C:\\Program Files (x86)\\AMS Services\\TransactNOW\\OALaunch.exe"
]
[process where event.action in ("start", "already_running") and
 (
  (process.name : "msiexec.exe" and process.args == "/V") or

  (process.parent.name : "msiexec.exe" and process.parent.args == "/V")
  )]
'''

min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true

[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
tree = true

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

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

[[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 = "7.15.0"

Stages and Predicates

Stage 1: process

[process where event.action == "start" and
 (
 ((process.pe.original_file_name : "devinit.dll" or process.name : "devinit.exe") and
   process.args : "msi-install" and process.command_line : "*http*") or

 (process.name : "msiexec.exe" and process.args :("/i", "-i") and
  process.args : ("/q", "-q", "/qn", "-qn") and process.args : "\\\\*@*\\*.msi") or

 (process.name : "msiexec.exe" and process.args : ("-PaCKagE", "/PaCKagE", "-fv") and
  process.args : ("/qn", "-qn", "-q", "/q", "/quiet") and process.command_line : "*http*") or

 (process.name : "msiexec.exe" and process.args :("/i", "-i") and
  process.args : ("/qn", "-qn", "-q", "/q") and
  process.command_line : ("*transforms*http:*", "*transforms*https:*", "*http*INSTALLDIR=%LOCALAPPDATA%*") and
  not process.parent.executable : ("D:\\Visma\\Install\\FDN\\PIN\\Client\\Base\\SW\\24200\\PublicInstallerNextGen.exe",
                                   "C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\Updates\\AgentUpgrader.exe"))  or

 (process.name : "powershell.exe" and process.command_line : "*WindowsInstaller*" and
  process.command_line : "*http*" and process.command_line : "*InstallProduct*")  or

 (process.name : "msiexec.exe" and
  process.parent.name : ("explorer.exe", "python.exe") and process.args : ("/i", "-i") and
  process.command_line : "*http*") or

 ((process.pe.original_file_name : "msiexec.exe" or process.name : "msiexec.exe") and
  process.command_line : "*http*" and process.args_count <= 5 and
  (
   (process.args : ("/i", "-i") and process.args : ("/q", "/quiet", "/qn", "-q", "-quiet", "-qn", "-Q+")) or
   process.args : ("*-Q-I*", "*-I-Q*", "*/q-i*", "*-q/i*", "*/q/i*") or
   (process.parent.name : "cmd.exe" and process.parent.args : "/v/r*")
   )
    and
  not descendant of
       [process where event.action == "start" and process.name : "*setup*" and process.code_signature.trusted == true] and
  not process.Ext.token.integrity_level_name == "system")
) and
not process.args :
          ("https://download.microsoft.com/download/*.msi",
           "APIURL=http*",
           "TRANSFORMS=C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\\\Updates\\UEMSAgent.mst",
           "SERVERNAME=*.manageengine.com", 
           "C:\\Program Files (x86)\\ManageEngine\\UEMS_DistributionServer\\\\Updates\\UEMSDistributionServer.msi",
           "https://awscli.amazonaws.com/AWSCLIV2.msi",
           "SERVERURL=https://*.apparmor.com",
           "INSTALLARGS=--url=https://*.fleet.us-east-2.aws.elastic-cloud.com:443*",
           "https://cdn.zabbix.com/zabbix/binaries/stable/*.msi",
           "INSTALLARGS=--url=https://*--enrollment-token=*",
           "C:\\WINDOWS\\_ScriptingFramework\\Logs\\Software\\*.log",
           "?:\\*\\http*.msi",
           "C:\\WINDOWS\\ccmcache\\*.msi",
           "C:\\Windows\\Temp\\*.msi",
           "\\\\*\\NETLOGON\\*.msi") and
not process.parent.executable :
                     ("C:\\Program Files (x86)\\Novell\\ZENworks\\bin\\ZenworksWindowsService.exe",
                      "C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\Updates\\AgentUpgrader.exe",
                      "C:\\Program Files (x86)\\FastTrack Software\\Admin By Request\\AdminByRequest.exe") and
not process.executable : "C:\\Program Files (x86)\\AMS Services\\TransactNOW\\OALaunch.exe"
]

Stage 2: process

[process where event.action in ("start", "already_running") and
 (
  (process.name : "msiexec.exe" and process.args == "/V") or

  (process.parent.name : "msiexec.exe" and process.parent.args == "/V")
  )]

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argswildcardhttps://download.microsoft.com/download/*.msi, APIURL=http*, TRANSFORMS=C:\Program Files (x86)\ManageEngine\UEMS_Agent\\Updates\UEMSAgent.mst, SERVERNAME=*.manageengine.com, C:\Program Files (x86)\ManageEngine\UEMS_DistributionServer\\Updates\UEMSDistributionServer.msi, https://awscli.amazonaws.com/AWSCLIV2.msi, SERVERURL=https://*.apparmor.com, INSTALLARGS=--url=https://*.fleet.us-east-2.aws.elastic-cloud.com:443*, https://cdn.zabbix.com/zabbix/binaries/stable/*.msi, INSTALLARGS=--url=https://*--enrollment-token=*, C:\WINDOWS\_ScriptingFramework\Logs\Software\*.log, ?:\*\http*.msi, C:\WINDOWS\ccmcache\*.msi, C:\Windows\Temp\*.msi, \\*\NETLOGON\*.msiexcludes:process.args
process.executableeqC:\Program Files (x86)\AMS Services\TransactNOW\OALaunch.exeexcludes:process.executable field:"process.executable" value:"C:\Program Files (x86)\AMS Services\TransactNOW\OALaunch.exe"
process.parent.executableeqC:\Program Files (x86)\Novell\ZENworks\bin\ZenworksWindowsService.exe, C:\Program Files (x86)\ManageEngine\UEMS_Agent\Updates\AgentUpgrader.exe, C:\Program Files (x86)\FastTrack Software\Admin By Request\AdminByRequest.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files (x86)\Novell\ZENworks\bin\ZenworksWindowsService.exe" field:"process.parent.executable" value:"C:\Program Files (x86)\ManageEngine\UEMS_Agent\Updates\AgentUpgrader.exe" field:"process.parent.executable" value:"C:\Program Files (x86)\FastTrack Software\Admin By Request\AdminByRequest.exe"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
event.actionin
  • already_running corpus 2 (elastic 2)
  • start corpus 391 (elastic 391)
field:"EventType" kind:in
process.argseq
  • /V corpus 2 (elastic 2)
field:"process.args" kind:eq value:"/V"
process.argswildcard
  • *-I-Q*
  • *-Q-I*
  • *-q/i*
  • */q-i*
  • */q/i*
  • -PaCKagE
  • -Q+ corpus 2 (elastic 2)
  • -fv
  • -i corpus 14 (elastic 14)
  • -q corpus 4 (elastic 4)
  • -qn corpus 4 (elastic 4)
  • -quiet corpus 2 (elastic 2)
  • /PaCKagE
  • /i corpus 4 (elastic 4)
  • /q corpus 7 (elastic 7)
  • /qn corpus 4 (elastic 4)
  • /quiet corpus 5 (elastic 5)
  • \\*@*\*.msi
  • msi-install
field:"process.args" kind:wildcard
process.args_countle
  • 5 transforms: number corpus 3 (elastic 3)
field:"process.args_count" kind:le value:"5"
process.command_linewildcard
  • *InstallProduct*
  • *WindowsInstaller*
  • *http* corpus 52 (sigma 34, elastic 15, chronicle 2, splunk 1)
  • *http*INSTALLDIR=%LOCALAPPDATA%*
  • *transforms*http:*
  • *transforms*https:*
field:"CommandLine" kind:wildcard
process.namewildcard
  • devinit.exe
  • msiexec.exe corpus 46 (elastic 41, splunk 5)
  • powershell.exe corpus 184 (elastic 140, splunk 44)
field:"process_name" kind:wildcard
process.parent.argseq
  • /V corpus 2 (elastic 2)
field:"process.parent.args" kind:eq value:"/V"
process.parent.argswildcard
  • /v/r*
field:"process.parent.args" kind:wildcard value:"/v/r*"
process.parent.namewildcard
  • cmd.exe corpus 36 (elastic 31, splunk 4, kusto 1)
  • explorer.exe corpus 51 (elastic 50, splunk 1)
  • msiexec.exe corpus 19 (elastic 14, splunk 3, kusto 2)
  • python.exe corpus 4 (elastic 4)
field:"parent_process_name" kind:wildcard
process.pe.original_file_namewildcard
  • devinit.dll corpus 2 (elastic 2)
  • msiexec.exe corpus 20 (elastic 11, sigma 5, splunk 4)
field:"OriginalFileName" kind:wildcard