Detection rules › Elastic
Unsigned DLL from Suspicious Directory
Identifies a Windows trusted program running from locations often abused by adversaries to masquerade as a trusted program and loading a recently dropped DLL. This behavior may indicate an attempt to evade defenses via side-loading a malicious DLL within the memory space of a signed processes.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth |
Rule body
[rule]
description = """
Identifies a Windows trusted program running from locations often abused by adversaries to masquerade as a trusted
program and loading a recently dropped DLL. This behavior may indicate an attempt to evade defenses via side-loading a
malicious DLL within the memory space of a signed processes.
"""
id = "971462bd-6f34-4199-b79b-b5e26644a177"
license = "Elastic License v2"
name = "Unsigned DLL from Suspicious Directory"
os_list = ["windows"]
version = "1.0.13"
query = '''
library where
process.code_signature.trusted == true and dll.path != null and
dll.Ext.relative_file_creation_time <= 500 and
not dll.code_signature.status : ("trusted", "errorCode_endpoint*") and
/* Suspicious Paths */
dll.path : ("?:\\PerfLogs\\*.dll",
"?:\\Users\\*\\Pictures\\*.dll",
"?:\\Users\\*\\Music\\*.dll",
"?:\\Users\\Public\\*.dll",
"?:\\Windows\\Tasks\\*.dll",
"?:\\Windows\\System32\\Tasks\\*.dll",
"?:\\Intel\\*.dll",
"?:\\AMD\\Temp\\*.dll",
"?:\\Windows\\AppReadiness\\*.dll",
"?:\\Windows\\ServiceState\\*.dll",
"?:\\Windows\\security\\*.dll",
"?:\\Windows\\System\\*.dll",
"?:\\Windows\\IdentityCRL\\*.dll",
"?:\\Windows\\Branding\\*.dll",
"?:\\Windows\\csc\\*.dll",
"?:\\Windows\\DigitalLocker\\*.dll",
"?:\\Windows\\en-US\\*.dll",
"?:\\Windows\\wlansvc\\*.dll",
"?:\\Windows\\Prefetch\\*.dll",
"?:\\Windows\\Fonts\\*.dll",
"?:\\Windows\\diagnostics\\*.dll",
"?:\\Windows\\TAPI\\*.dll",
"?:\\Windows\\INF\\*.dll",
"?:\\windows\\tracing\\*.dll",
"?:\\windows\\IME\\*.dll",
"?:\\Windows\\Performance\\*.dll",
"?:\\windows\\intel\\*.dll",
"?:\\windows\\ms\\*.dll",
"?:\\Windows\\dot3svc\\*.dll",
"?:\\Windows\\ServiceProfiles\\*.dll",
"?:\\Windows\\panther\\*.dll",
"?:\\Windows\\RemotePackages\\*.dll",
"?:\\Windows\\OCR\\*.dll",
"?:\\Windows\\appcompat\\*.dll",
"?:\\Windows\\apppatch\\*.dll",
"?:\\Windows\\addins\\*.dll",
"?:\\Windows\\Setup\\*.dll",
"?:\\Windows\\Help\\*.dll",
"?:\\Windows\\SKB\\*.dll",
"?:\\Windows\\Vss\\*.dll",
"?:\\Windows\\Web\\*.dll",
"?:\\Windows\\servicing\\*.dll",
"?:\\Windows\\CbsTemp\\*.dll",
"?:\\Windows\\Logs\\*.dll",
"?:\\Windows\\WaaS\\*.dll",
"?:\\Windows\\twain_32\\*.dll",
"?:\\Windows\\ShellExperiences\\*.dll",
"?:\\Windows\\ShellComponents\\*.dll",
"?:\\Windows\\PLA\\*.dll",
"?:\\Windows\\Migration\\*.dll",
"?:\\Windows\\debug\\*.dll",
"?:\\Windows\\hp\\*.dll",
"?:\\Windows\\Cursors\\*.dll",
"?:\\Windows\\Containers\\*.dll",
"?:\\Windows\\Boot\\*.dll",
"?:\\Windows\\bcastdvr\\*.dll",
"?:\\Windows\\TextInput\\*.dll",
"?:\\Windows\\schemas\\*.dll",
"?:\\Windows\\SchCache\\*.dll",
"?:\\Windows\\Resources\\*.dll",
"?:\\Windows\\rescache\\*.dll",
"?:\\Windows\\Provisioning\\*.dll",
"?:\\Windows\\PrintDialog\\*.dll",
"?:\\Windows\\PolicyDefinitions\\*.dll",
"?:\\Windows\\media\\*.dll",
"?:\\Windows\\Globalization\\*.dll",
"?:\\Windows\\L2Schemas\\*.dll",
"?:\\Windows\\LiveKernelReports\\*.dll",
"?:\\Windows\\ModemLogs\\*.dll",
"?:\\Windows\\ImmersiveControlPanel\\*.dll",
"?:\\$Recycle.Bin\\*.dll",
"?:\\aaAntiRansomElastic-DO-NOT-TOUCH-*") and
/* DLL loaded from the process.executable current directory */
endswith~(substring(dll.path, 0, length(dll.path) - (length(dll.name) + 1)), substring(process.executable, 0, length(process.executable) - (length(process.name) + 1))) and
not (process.code_signature.trusted == true and process.code_signature.subject_name : ("PFU LIMITED", "SEIKO EPSON CORPORATION") and
process.executable : "?:\\Windows\\twain_32\\*.exe") and
not (process.code_signature.trusted == true and
process.code_signature.subject_name :
("Bedford, Freeman & Worth Publishing Group, LLC",
"Delta Electronics, Inc.",
"Hangzhou Hikvision Digital Tech.Co.,Ltd")) and
not dll.hash.sha256 : "7aea82c8c38a88e7c66ccae246367c261a6c230b5ce4540c7970c8eb1d8dc6ca"
'''
min_endpoint_version = "8.10.0"
reputation = true
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1204"
name = "User Execution"
reference = "https://attack.mitre.org/techniques/T1204/"
[[threat.technique.subtechnique]]
id = "T1204.002"
name = "Malicious File"
reference = "https://attack.mitre.org/techniques/T1204/002/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[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
process.code_signature.trusted == true and dll.path != null and
dll.Ext.relative_file_creation_time <= 500 and
not dll.code_signature.status : ("trusted", "errorCode_endpoint*") and
dll.path : ("?:\\PerfLogs\\*.dll",
"?:\\Users\\*\\Pictures\\*.dll",
"?:\\Users\\*\\Music\\*.dll",
"?:\\Users\\Public\\*.dll",
"?:\\Windows\\Tasks\\*.dll",
"?:\\Windows\\System32\\Tasks\\*.dll",
"?:\\Intel\\*.dll",
"?:\\AMD\\Temp\\*.dll",
"?:\\Windows\\AppReadiness\\*.dll",
"?:\\Windows\\ServiceState\\*.dll",
"?:\\Windows\\security\\*.dll",
"?:\\Windows\\System\\*.dll",
"?:\\Windows\\IdentityCRL\\*.dll",
"?:\\Windows\\Branding\\*.dll",
"?:\\Windows\\csc\\*.dll",
"?:\\Windows\\DigitalLocker\\*.dll",
"?:\\Windows\\en-US\\*.dll",
"?:\\Windows\\wlansvc\\*.dll",
"?:\\Windows\\Prefetch\\*.dll",
"?:\\Windows\\Fonts\\*.dll",
"?:\\Windows\\diagnostics\\*.dll",
"?:\\Windows\\TAPI\\*.dll",
"?:\\Windows\\INF\\*.dll",
"?:\\windows\\tracing\\*.dll",
"?:\\windows\\IME\\*.dll",
"?:\\Windows\\Performance\\*.dll",
"?:\\windows\\intel\\*.dll",
"?:\\windows\\ms\\*.dll",
"?:\\Windows\\dot3svc\\*.dll",
"?:\\Windows\\ServiceProfiles\\*.dll",
"?:\\Windows\\panther\\*.dll",
"?:\\Windows\\RemotePackages\\*.dll",
"?:\\Windows\\OCR\\*.dll",
"?:\\Windows\\appcompat\\*.dll",
"?:\\Windows\\apppatch\\*.dll",
"?:\\Windows\\addins\\*.dll",
"?:\\Windows\\Setup\\*.dll",
"?:\\Windows\\Help\\*.dll",
"?:\\Windows\\SKB\\*.dll",
"?:\\Windows\\Vss\\*.dll",
"?:\\Windows\\Web\\*.dll",
"?:\\Windows\\servicing\\*.dll",
"?:\\Windows\\CbsTemp\\*.dll",
"?:\\Windows\\Logs\\*.dll",
"?:\\Windows\\WaaS\\*.dll",
"?:\\Windows\\twain_32\\*.dll",
"?:\\Windows\\ShellExperiences\\*.dll",
"?:\\Windows\\ShellComponents\\*.dll",
"?:\\Windows\\PLA\\*.dll",
"?:\\Windows\\Migration\\*.dll",
"?:\\Windows\\debug\\*.dll",
"?:\\Windows\\hp\\*.dll",
"?:\\Windows\\Cursors\\*.dll",
"?:\\Windows\\Containers\\*.dll",
"?:\\Windows\\Boot\\*.dll",
"?:\\Windows\\bcastdvr\\*.dll",
"?:\\Windows\\TextInput\\*.dll",
"?:\\Windows\\schemas\\*.dll",
"?:\\Windows\\SchCache\\*.dll",
"?:\\Windows\\Resources\\*.dll",
"?:\\Windows\\rescache\\*.dll",
"?:\\Windows\\Provisioning\\*.dll",
"?:\\Windows\\PrintDialog\\*.dll",
"?:\\Windows\\PolicyDefinitions\\*.dll",
"?:\\Windows\\media\\*.dll",
"?:\\Windows\\Globalization\\*.dll",
"?:\\Windows\\L2Schemas\\*.dll",
"?:\\Windows\\LiveKernelReports\\*.dll",
"?:\\Windows\\ModemLogs\\*.dll",
"?:\\Windows\\ImmersiveControlPanel\\*.dll",
"?:\\$Recycle.Bin\\*.dll",
"?:\\aaAntiRansomElastic-DO-NOT-TOUCH-*") and
endswith~(substring(dll.path, 0, length(dll.path) - (length(dll.name) + 1)), substring(process.executable, 0, length(process.executable) - (length(process.name) + 1))) and
not (process.code_signature.trusted == true and process.code_signature.subject_name : ("PFU LIMITED", "SEIKO EPSON CORPORATION") and
process.executable : "?:\\Windows\\twain_32\\*.exe") and
not (process.code_signature.trusted == true and
process.code_signature.subject_name :
("Bedford, Freeman & Worth Publishing Group, LLC",
"Delta Electronics, Inc.",
"Hangzhou Hikvision Digital Tech.Co.,Ltd")) and
not dll.hash.sha256 : "7aea82c8c38a88e7c66ccae246367c261a6c230b5ce4540c7970c8eb1d8dc6ca"
Exclusions
The rule actively suppresses these predicates.
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.path | is_not_null | field:"ImageLoaded" kind:is_not_null | |
dll.path | wildcard |
| field:"ImageLoaded" kind:wildcard |
process.code_signature.trusted | eq |
| field:"process.code_signature.trusted" kind:eq value:"true" |