Detection rules › Elastic

Suspicious Startup Persistence via a Windows Installer

Source
github.com/elastic/protections-artifacts

Identifies when the Windows installer process msiexec.exe creates a new persistence entry via the Run key or Startup folder and set to run a suspicious commands or file type.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies when the Windows installer process msiexec.exe creates a new persistence entry via the Run key or Startup
folder and set to run a suspicious commands or file type.
"""
id = "9f7aece1-355c-4e72-a7ea-767d5cccb12d"
license = "Elastic License v2"
name = "Suspicious Startup Persistence via a Windows Installer"
os_list = ["windows"]
version = "1.0.5"

query = '''
any where process.name : "msiexec.exe" and
  (
   (event.category == "registry" and event.action == "modification" and
    registry.path : ("H*\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
                     "H*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
                     "H*\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
                     "H*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*") and
    registry.data.strings : ("*C:\\Users*\\*\\Contacts\\*", "*cmd*/c*", "*powershell*", "*node.exe*.js*", "*rundll32*",
                             "*mshta.exe*", "*wscript.exe*", "*cscript.exe*", "*C:\\Users\\Public\\*") and
    not registry.data.strings :
                  ("rundll32.exe \"?:\\Program Files\\VMware\\VMware View\\Agent\\bin\\MessageFrameWork.dll\",EnvSyncW",
                   "rundll32.exe ?:\\PROGRA~1\\Omnissa\\Horizon\\Agent\\bin\\MESSAG~1.DLL,EnvSyncW",
                   "rundll32.exe \"?:\\Program Files\\Omnissa\\Horizon\\Agent\\bin\\MessageFrameWork.dll\",EnvSyncW",
                   "rundll32.exe DR*Svc.dll,EntryPointUserMessage",
                   "rundll32.exe DR*SVC.dll, EntryPointUserMessage",
                   "rundll32.exe P*Svc.dll, EntryPointUserMessage",
                   "rundll32.exe DRV*.dll,EntryPointUserMessage",
                   "rundll32.exe P*.dll,EntryPointUserMessage",
                   "C:\\Users\\Public\\RES\\RESPrinter\\FileWatcher.exe")) or

    (event.category == "file" and event.action == "creation" and
     file.extension in~ ("bat", "cmd", "js", "vbs", "wsh", "hta", "exe", "pif", "scr", "cpl", "jse", "vbe", "ps1") and
     file.path : ("?:\\programdata\\microsoft\\windows\\start menu\\programs\\startup\\*",
                  "?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*"))
  )
'''

min_endpoint_version = "8.4.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 = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"
[[threat.technique.subtechnique]]
id = "T1547.001"
name = "Registry Run Keys / Startup Folder"
reference = "https://attack.mitre.org/techniques/T1547/001/"



[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[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.4.0"

Stages and Predicates

Stage 1: any

any where process.name : "msiexec.exe" and
  (
   (event.category == "registry" and event.action == "modification" and
    registry.path : ("H*\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
                     "H*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\\*",
                     "H*\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*",
                     "H*\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run\\*") and
    registry.data.strings : ("*C:\\Users*\\*\\Contacts\\*", "*cmd*/c*", "*powershell*", "*node.exe*.js*", "*rundll32*",
                             "*mshta.exe*", "*wscript.exe*", "*cscript.exe*", "*C:\\Users\\Public\\*") and
    not registry.data.strings :
                  ("rundll32.exe \"?:\\Program Files\\VMware\\VMware View\\Agent\\bin\\MessageFrameWork.dll\",EnvSyncW",
                   "rundll32.exe ?:\\PROGRA~1\\Omnissa\\Horizon\\Agent\\bin\\MESSAG~1.DLL,EnvSyncW",
                   "rundll32.exe \"?:\\Program Files\\Omnissa\\Horizon\\Agent\\bin\\MessageFrameWork.dll\",EnvSyncW",
                   "rundll32.exe DR*Svc.dll,EntryPointUserMessage",
                   "rundll32.exe DR*SVC.dll, EntryPointUserMessage",
                   "rundll32.exe P*Svc.dll, EntryPointUserMessage",
                   "rundll32.exe DRV*.dll,EntryPointUserMessage",
                   "rundll32.exe P*.dll,EntryPointUserMessage",
                   "C:\\Users\\Public\\RES\\RESPrinter\\FileWatcher.exe")) or

    (event.category == "file" and event.action == "creation" and
     file.extension in~ ("bat", "cmd", "js", "vbs", "wsh", "hta", "exe", "pif", "scr", "cpl", "jse", "vbe", "ps1") and
     file.path : ("?:\\programdata\\microsoft\\windows\\start menu\\programs\\startup\\*",
                  "?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*"))
  )

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • creation corpus 58 (elastic 58)
  • modification corpus 72 (elastic 72)
field:"EventType" kind:eq
event.categoryeq
  • file corpus 43 (elastic 43)
  • registry corpus 14 (elastic 14)
field:"event.category" kind:eq
file.extensionin
  • bat corpus 13 (elastic 13)
  • cmd corpus 15 (elastic 15)
  • cpl corpus 19 (elastic 19)
  • exe corpus 32 (elastic 32)
  • hta corpus 20 (elastic 20)
  • js corpus 23 (elastic 23)
  • jse corpus 18 (elastic 18)
  • pif corpus 18 (elastic 18)
  • ps1 corpus 9 (elastic 9)
  • scr corpus 17 (elastic 17)
  • vbe corpus 18 (elastic 18)
  • vbs corpus 19 (elastic 19)
  • wsh corpus 16 (elastic 16)
field:"file.extension" kind:in
file.pathwildcard
  • ?:\Users\*\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\* corpus 13 (elastic 13)
  • ?:\programdata\microsoft\windows\start menu\programs\startup\*
field:"TargetFilename" kind:wildcard
process.namewildcard
  • msiexec.exe corpus 46 (elastic 41, splunk 5)
field:"process_name" kind:wildcard value:"msiexec.exe"
registry.data.stringswildcard
  • *C:\Users*\*\Contacts\*
  • *C:\Users\Public\*
  • *cmd*/c*
  • *cscript.exe*
  • *mshta.exe*
  • *node.exe*.js*
  • *powershell* corpus 11 (sigma 9, elastic 1, chronicle 1)
  • *rundll32* corpus 4 (sigma 4)
  • *wscript.exe*
field:"Details" kind:wildcard
registry.pathwildcard
  • H*\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run\* corpus 11 (elastic 11)
  • H*\Software\Microsoft\Windows\CurrentVersion\Run\* corpus 12 (elastic 12)
  • H*\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run\* corpus 11 (elastic 11)
  • H*\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run\* corpus 11 (elastic 11)
field:"TargetObject" kind:wildcard