Detection rules › Elastic
Known Desktop Application DLL Search Order Hijack
Identifies attempts to load an unsigned DLL file to a known desktop application dependencies folder such as Slack, Teams or OneDrive. This may indicate an attempt to load a malicious module via DLL search order hijacking.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule body
[rule]
description = """
Identifies attempts to load an unsigned DLL file to a known desktop application dependencies folder such as Slack, Teams
or OneDrive. This may indicate an attempt to load a malicious module via DLL search order hijacking.
"""
id = "60b68900-08b4-4bd3-832a-6e36e0921d74"
license = "Elastic License v2"
name = "Known Desktop Application DLL Search Order Hijack"
os_list = ["windows"]
reference = [
"https://posts.specterops.io/automating-dll-hijack-discovery-81c4295904b0",
"https://www.elastic.co/security-labs/Hunting-for-Suspicious-Windows-Libraries-for-Execution-and-Evasion",
]
version = "1.0.2"
query = '''
library where
(dll.Ext.relative_file_creation_time <= 500 or dll.Ext.relative_file_name_modify_time <= 500) and
(dll.code_signature.trusted == false or dll.code_signature.exists == false) and
not dll.code_signature.status like "errorCode_endpoint*" and
dll.path :
("?:\\Users\\*\\AppData\\*\\Microsoft\\OneDrive\\*.dll",
"?:\\Users\\*\\AppData\\*\\Microsoft OneDrive\\*.dll",
"?:\\Users\\*\\AppData\\*\\Microsoft\\Teams\\*.dll",
"?:\\Users\\*\\AppData\\Local\\slack\\app-*\\*.dll",
"?:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\*.dll",
"?:\\Users\\*\\AppData\\Local\\*\\Well Known Domains\\*\\well_known_domains.dll",
"?:\\Users\\*\\AppData\\Local\\*\\Domain Actions\\*\\domain_actions.dll") and
not dll.path : ("?:\\Users\\*\\AppData\\Local\\Microsoft\\OneDrive\\*\\*.dll",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\Teams\\current\\resources\\meeting-addin\\*",
"?:\\Users\\*\\Teams\\current\\*")
'''
min_endpoint_version = "8.10.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 = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[threat.technique.subtechnique]]
id = "T1574.001"
name = "DLL"
reference = "https://attack.mitre.org/techniques/T1574/001/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.10.0"
Stages and Predicates
Stage 1: library
library where
(dll.Ext.relative_file_creation_time <= 500 or dll.Ext.relative_file_name_modify_time <= 500) and
(dll.code_signature.trusted == false or dll.code_signature.exists == false) and
not dll.code_signature.status like "errorCode_endpoint*" and
dll.path :
("?:\\Users\\*\\AppData\\*\\Microsoft\\OneDrive\\*.dll",
"?:\\Users\\*\\AppData\\*\\Microsoft OneDrive\\*.dll",
"?:\\Users\\*\\AppData\\*\\Microsoft\\Teams\\*.dll",
"?:\\Users\\*\\AppData\\Local\\slack\\app-*\\*.dll",
"?:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\*.dll",
"?:\\Users\\*\\AppData\\Local\\*\\Well Known Domains\\*\\well_known_domains.dll",
"?:\\Users\\*\\AppData\\Local\\*\\Domain Actions\\*\\domain_actions.dll") and
not dll.path : ("?:\\Users\\*\\AppData\\Local\\Microsoft\\OneDrive\\*\\*.dll",
"?:\\Users\\*\\AppData\\Local\\Microsoft\\Teams\\current\\resources\\meeting-addin\\*",
"?:\\Users\\*\\Teams\\current\\*")
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
dll.code_signature.status | starts_with | errorCode_endpoint | excludes:dll.code_signature.status field:"dll.code_signature.status" value:"errorCode_endpoint" |
dll.path | wildcard | ?:\Users\*\AppData\Local\Microsoft\OneDrive\*\*.dll, ?:\Users\*\AppData\Local\Microsoft\Teams\current\resources\meeting-addin\*, ?:\Users\*\Teams\current\* | excludes:dll.path field:"dll.path" value:"?:\Users\*\AppData\Local\Microsoft\OneDrive\*\*.dll" field:"dll.path" value:"?:\Users\*\AppData\Local\Microsoft\Teams\current\resources\meeting-addin\*" field:"dll.path" value:"?:\Users\*\Teams\current\*" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dll.Ext.relative_file_creation_time | le |
| field:"dll.Ext.relative_file_creation_time" kind:le value:"500" |
dll.Ext.relative_file_name_modify_time | le |
| field:"dll.Ext.relative_file_name_modify_time" kind:le value:"500" |
dll.code_signature.exists | eq |
| field:"dll.code_signature.exists" kind:eq value:"false" |
dll.code_signature.trusted | eq |
| field:"dll.code_signature.trusted" kind:eq value:"false" |
dll.path | wildcard |
| field:"ImageLoaded" kind:wildcard |