Detection rules › Elastic
Unusual File Written or Modified in Startup Folder
Identifies suspicious file extensions or names written to the startup folder. Adversaries may use this technique to maintain persistence.
MITRE ATT&CK coverage
Rule body
[rule]
description = """
Identifies suspicious file extensions or names written to the startup folder. Adversaries may use this technique to
maintain persistence.
"""
id = "30a90136-7831-41c3-a2aa-1a303c1186ac"
license = "Elastic License v2"
name = "Unusual File Written or Modified in Startup Folder"
os_list = ["windows"]
version = "1.0.41"
query = '''
file where event.action != "deletion" and
process.pid != 4 and process.executable != null and
file.name != null and not user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
file.path : ("?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*",
"?:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\*") and
(
/* file extensions rarely written to Startup folder by legit installers */
file.extension : ("exe", "com", "scr", "dll", "hta", "ps1", "cmd", "url", "wsh", "wsf", "vbe", "jse", "sick", "png", "jpg", "manifest", "ahk", "jar") or
/* suspicious file names */
length(file.name) <= 6 or
file.name :
("*Microsoft*",
"*fuck*",
"*:*",
"*.*.",
"*update*",
"*windows*",
"*setup*",
"*googl*",
"*adobe*",
"*chrome*")
) and
not process.executable :
("?:\\Windows\\SysWOW64\\msiexec.exe",
"?:\\Windows\\system32\\msiexec.exe",
"?:\\Windows\\explorer.exe",
"?:\\Windows\\System32\\svchost.exe",
"?:\\Windows\\System32\\dllhost.exe",
"?:\\Windows\\System32\\xcopy.exe",
"?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*.exe",
"?:\\ProgramData\\Microsoft\\Windows Defender Advanced Threat Protection\\Platform\\*.exe",
"?:\\Program Files\\Windows Defender Advanced Threat Protection\\*.exe",
"\\Device\\Mup\\*\\SysVol\\*") and
not (process.executable : ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe") and not process.name : "javaw.exe") and
not (process.name : "cmd.exe" and file.extension : "cmd") and
not (process.code_signature.subject_name :
("Intercontinental Exchange, Inc.", "Chocolatey Software, Inc.", "ONELAUNCH TECHNOLOGIES INC.",
"Notepad++", "Ghisler Software GmbH", "Western Union Holdings Inc.", "AnyDesk Software GmbH", "Learnpulse SAS") and
process.code_signature.status : ("trusted", "errorExpired", "errorCode_endpoint*")) and
not (process.executable : "?:\\Windows\\System32\\notepad.exe" and file.extension : ("bat", "cmd")) and
not (process.executable : "C:\\Windows\\SysWOW64\\cscript.exe" and file.name : "WUPOSStartup.exe") and
not (process.name : "cmd.exe" and file.name : "MonitorES.exe")
'''
min_endpoint_version = "8.0.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/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[[threat.technique.subtechnique]]
id = "T1036.005"
name = "Match Legitimate Resource Name or Location"
reference = "https://attack.mitre.org/techniques/T1036/005/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.0.0"
Stages and Predicates
Stage 1: file
file where event.action != "deletion" and
process.pid != 4 and process.executable != null and
file.name != null and not user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
file.path : ("?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*",
"?:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\*") and
(
file.extension : ("exe", "com", "scr", "dll", "hta", "ps1", "cmd", "url", "wsh", "wsf", "vbe", "jse", "sick", "png", "jpg", "manifest", "ahk", "jar") or
length(file.name) <= 6 or
file.name :
("*Microsoft*",
"*fuck*",
"*:*",
"*.*.",
"*update*",
"*windows*",
"*setup*",
"*googl*",
"*adobe*",
"*chrome*")
) and
not process.executable :
("?:\\Windows\\SysWOW64\\msiexec.exe",
"?:\\Windows\\system32\\msiexec.exe",
"?:\\Windows\\explorer.exe",
"?:\\Windows\\System32\\svchost.exe",
"?:\\Windows\\System32\\dllhost.exe",
"?:\\Windows\\System32\\xcopy.exe",
"?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*.exe",
"?:\\ProgramData\\Microsoft\\Windows Defender Advanced Threat Protection\\Platform\\*.exe",
"?:\\Program Files\\Windows Defender Advanced Threat Protection\\*.exe",
"\\Device\\Mup\\*\\SysVol\\*") and
not (process.executable : ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe") and not process.name : "javaw.exe") and
not (process.name : "cmd.exe" and file.extension : "cmd") and
not (process.code_signature.subject_name :
("Intercontinental Exchange, Inc.", "Chocolatey Software, Inc.", "ONELAUNCH TECHNOLOGIES INC.",
"Notepad++", "Ghisler Software GmbH", "Western Union Holdings Inc.", "AnyDesk Software GmbH", "Learnpulse SAS") and
process.code_signature.status : ("trusted", "errorExpired", "errorCode_endpoint*")) and
not (process.executable : "?:\\Windows\\System32\\notepad.exe" and file.extension : ("bat", "cmd")) and
not (process.executable : "C:\\Windows\\SysWOW64\\cscript.exe" and file.name : "WUPOSStartup.exe") and
not (process.name : "cmd.exe" and file.name : "MonitorES.exe")
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.name | eq | javaw.exe | excludes:process.name field:"process.name" value:"javaw.exe" |
process.executable | wildcard | ?:\Program Files\*.exe, ?:\Program Files (x86)\*.exe | excludes:process.executable field:"process.executable" value:"?:\Program Files\*.exe" field:"process.executable" value:"?:\Program Files (x86)\*.exe" |
file.extension | eq | bat, cmd | excludes:file.extension field:"file.extension" value:"bat" field:"file.extension" value:"cmd" |
process.executable | eq | ?:\Windows\System32\notepad.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\System32\notepad.exe" |
file.extension | eq | cmd | excludes:file.extension field:"file.extension" value:"cmd" |
process.name | eq | cmd.exe | excludes:process.name field:"process.name" value:"cmd.exe" |
file.name | eq | MonitorES.exe | excludes:file.name field:"file.name" value:"MonitorES.exe" |
file.name | eq | WUPOSStartup.exe | excludes:file.name field:"file.name" value:"WUPOSStartup.exe" |
process.executable | eq | C:\Windows\SysWOW64\cscript.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\SysWOW64\cscript.exe" |
process.code_signature.status | wildcard | trusted, errorExpired, errorCode_endpoint* | excludes:process.code_signature.status field:"process.code_signature.status" value:"trusted" field:"process.code_signature.status" value:"errorExpired" field:"process.code_signature.status" value:"errorCode_endpoint*" |
process.code_signature.subject_name | eq | Intercontinental Exchange, Inc., Chocolatey Software, Inc., ONELAUNCH TECHNOLOGIES INC., Notepad++, Ghisler Software GmbH, Western Union Holdings Inc., AnyDesk Software GmbH, Learnpulse SAS | excludes:process.code_signature.subject_name |
process.executable | wildcard | ?:\Windows\SysWOW64\msiexec.exe, ?:\Windows\system32\msiexec.exe, ?:\Windows\explorer.exe, ?:\Windows\System32\svchost.exe, ?:\Windows\System32\dllhost.exe, ?:\Windows\System32\xcopy.exe, ?:\ProgramData\Microsoft\Windows Defender\Platform\*.exe, ?:\ProgramData\Microsoft\Windows Defender Advanced Threat Protection\Platform\*.exe, ?:\Program Files\Windows Defender Advanced Threat Protection\*.exe, \Device\Mup\*\SysVol\* | excludes:process.executable |
user.id | eq | S-1-5-18, S-1-5-19, S-1-5-20 | excludes:user.id field:"user.id" value:"S-1-5-18" field:"user.id" value:"S-1-5-19" field:"user.id" value:"S-1-5-20" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | ne |
| field:"EventType" kind:ne value:"deletion" |
file.extension | wildcard |
| field:"file.extension" kind:wildcard |
file.name | is_not_null | field:"file.name" kind:is_not_null | |
file.name | wildcard |
| field:"file.name" kind:wildcard |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard |
process.executable | is_not_null | field:"Image" kind:is_not_null | |
process.name | wildcard |
| field:"process_name" kind:wildcard value:"javaw.exe" |
process.pid | ne |
| field:"process_id" kind:ne value:"4" |