Detection rules › Elastic

Startup Persistence via Unusual Process

Source
github.com/elastic/protections-artifacts

Identifies files written to or modified in the startup folder by an unusual Microsoft process. Adversaries may use this technique to maintain persistence.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies files written to or modified in the startup folder by an unusual Microsoft process. Adversaries may use this
technique to maintain persistence.
"""
id = "95d13ce1-ffb2-4be8-a56e-cc9a891e81e2"
license = "Elastic License v2"
name = "Startup Persistence via Unusual Process"
os_list = ["windows"]
version = "1.0.38"

query = '''
file where event.action != "deletion" and
  file.path : ("?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*",
               "?:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\*") and
  process.executable : "?:\\Windows\\*" and
  /* Issue #297 */
  not file.name : "desktop.ini" and
  not process.executable : "?:\\Windows\\Application Compatibility Scripts\\acregl.exe" and
  not process.executable : "?:\\Windows\\Temp\\*.exe" and
  not user.id : "S-1-5-18" and
  not process.name :
           ("wscript.exe",
            "cscript.exe",
            "powershell.exe",
            "explorer.exe",
            "dllhost.exe",
            "notepad.exe",
            "cmd.exe",
            "Robocopy.exe",
            "xcopy.exe",
            "wuauclt.exe",
            "msiexec.exe",
            "CompPkgSrv.exe",
            "rundll32.exe",
            "svchost.exe",
            "sc.exe",
            "backgroundTaskHost.exe",
            "AppVClient.exe") and
  not file.extension : ("TMP", "INF", "INI", "DDF", "CAB", "RPT", "RDP", "ppk")
'''

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

[[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/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: file

file where event.action != "deletion" and
  file.path : ("?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*",
               "?:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\*") and
  process.executable : "?:\\Windows\\*" and
  not file.name : "desktop.ini" and
  not process.executable : "?:\\Windows\\Application Compatibility Scripts\\acregl.exe" and
  not process.executable : "?:\\Windows\\Temp\\*.exe" and
  not user.id : "S-1-5-18" and
  not process.name :
           ("wscript.exe",
            "cscript.exe",
            "powershell.exe",
            "explorer.exe",
            "dllhost.exe",
            "notepad.exe",
            "cmd.exe",
            "Robocopy.exe",
            "xcopy.exe",
            "wuauclt.exe",
            "msiexec.exe",
            "CompPkgSrv.exe",
            "rundll32.exe",
            "svchost.exe",
            "sc.exe",
            "backgroundTaskHost.exe",
            "AppVClient.exe") and
  not file.extension : ("TMP", "INF", "INI", "DDF", "CAB", "RPT", "RDP", "ppk")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.extensioneqTMP, INF, INI, DDF, CAB, RPT, RDP, ppkexcludes:file.extension
file.nameeqdesktop.iniexcludes:file.name field:"file.name" value:"desktop.ini"
process.executableeq?:\Windows\Application Compatibility Scripts\acregl.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\Application Compatibility Scripts\acregl.exe"
process.executablewildcard?:\Windows\Temp\*.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\Temp\*.exe"
process.nameeqwscript.exe, cscript.exe, powershell.exe, explorer.exe, dllhost.exe, notepad.exe, cmd.exe, Robocopy.exe, xcopy.exe, wuauclt.exe, msiexec.exe, CompPkgSrv.exe, rundll32.exe, svchost.exe, sc.exe, backgroundTaskHost.exe, AppVClient.exeexcludes:process.name
user.ideqS-1-5-18excludes:user.id field:"user.id" value:"S-1-5-18"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionne
  • deletion corpus 86 (elastic 86)
field:"EventType" kind:ne value:"deletion"
file.pathwildcard
  • ?:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\*
  • ?:\Users\*\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\* corpus 13 (elastic 13)
field:"TargetFilename" kind:wildcard
process.executablewildcard
  • ?:\Windows\* corpus 5 (elastic 5)
field:"Image" kind:wildcard value:"?:\Windows\*"