Suspicious DLL Loaded for Persistence or Privilege Escalation
Identifies the loading of a non Microsoft signed DLL that is missing on a default Windows install (phantom DLL) or one that can be loaded from a different location by a native Windows process. This may be abused to persist or elevate privileges via privileged file write vulnerabilities.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/01/07"
3integration = ["endpoint", "windows"]
4maturity = "production"
5updated_date = "2026/01/02"
6
7[rule]
8author = ["Elastic"]
9description = """
10Identifies the loading of a non Microsoft signed DLL that is missing on a default Windows install (phantom DLL) or one
11that can be loaded from a different location by a native Windows process. This may be abused to persist or elevate
12privileges via privileged file write vulnerabilities.
13"""
14from = "now-9m"
15index = ["winlogbeat-*", "logs-endpoint.events.library-*", "logs-windows.sysmon_operational-*"]
16language = "eql"
17license = "Elastic License v2"
18name = "Suspicious DLL Loaded for Persistence or Privilege Escalation"
19note = """## Triage and analysis
20
21### Investigating Suspicious DLL Loaded for Persistence or Privilege Escalation
22
23Attackers can execute malicious code by abusing missing modules that processes try to load, enabling them to escalate privileges or gain persistence. This rule identifies the loading of a non-Microsoft-signed DLL that is missing on a default Windows installation or one that can be loaded from a different location by a native Windows process.
24
25#### Possible investigation steps
26
27- Examine the DLL signature and identify the process that created it.
28 - Investigate any abnormal behaviors by the process such as network connections, registry or file modifications, and any spawned child processes.
29- Investigate other alerts associated with the user/host during the past 48 hours.
30- Retrieve the DLL and determine if it is malicious:
31 - Use a private sandboxed malware analysis system to perform analysis.
32 - Observe and collect information about the following activities:
33 - Attempts to contact external domains and addresses.
34 - File and registry access, modification, and creation activities.
35 - Service creation and launch activities.
36 - Scheduled task creation.
37 - Use the PowerShell Get-FileHash cmdlet to get the files' SHA-256 hash values.
38 - Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
39
40### False positive analysis
41
42- This activity is unlikely to happen legitimately. Any activity that triggered the alert and is not inherently malicious must be monitored by the security team.
43
44### Response and remediation
45
46- Initiate the incident response process based on the outcome of the triage.
47- Isolate the involved host to prevent further post-compromise behavior.
48- If the triage identified malware, search the environment for additional compromised hosts.
49 - Implement temporary network rules, procedures, and segmentation to contain the malware.
50 - Stop suspicious processes.
51 - Immediately block the identified indicators of compromise (IoCs).
52 - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
53- Remove and block malicious artifacts identified during triage.
54- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
55- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
56- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
57- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
58"""
59references = [
60 "https://itm4n.github.io/windows-dll-hijacking-clarified/",
61 "http://remoteawesomethoughts.blogspot.com/2019/05/windows-10-task-schedulerservice.html",
62 "https://googleprojectzero.blogspot.com/2018/04/windows-exploitation-tricks-exploiting.html",
63 "https://shellz.club/2020/10/16/edgegdi-dll-for-persistence-and-lateral-movement.html",
64 "https://windows-internals.com/faxing-your-way-to-system/",
65 "http://waleedassar.blogspot.com/2013/01/wow64logdll.html",
66]
67risk_score = 73
68rule_id = "bfeaf89b-a2a7-48a3-817f-e41829dc61ee"
69setup = """## Setup
70
71If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
72events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
73Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
74`event.ingested` to @timestamp.
75For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
76"""
77severity = "high"
78tags = [
79 "Domain: Endpoint",
80 "OS: Windows",
81 "Use Case: Threat Detection",
82 "Tactic: Persistence",
83 "Tactic: Privilege Escalation",
84 "Tactic: Defense Evasion",
85 "Resources: Investigation Guide",
86 "Data Source: Elastic Defend",
87 "Data Source: Sysmon",
88]
89timestamp_override = "event.ingested"
90type = "eql"
91
92query = '''
93any where host.os.type == "windows" and
94(
95 /* Elastic Defend DLL load events */
96 (event.category == "library" and
97 (
98 ?dll.name : ("wlbsctrl.dll", "wbemcomn.dll", "WptsExtensions.dll", "Tsmsisrv.dll", "TSVIPSrv.dll", "Msfte.dll", "wow64log.dll", "WindowsCoreDeviceInfo.dll", "Ualapi.dll", "wlanhlp.dll", "phoneinfo.dll", "EdgeGdi.dll", "cdpsgshims.dll", "windowsperformancerecordercontrol.dll", "diagtrack_win.dll", "TPPCOIPW32.dll", "tpgenlic.dll", "thinmon.dll", "fxsst.dll", "msTracer.dll") or
99
100 (?dll.path : "?:\\Windows\\*\\oci.dll" and process.executable : "?:\\Windows\\*.exe")
101 )
102 and (?dll.code_signature.trusted == false or ?dll.code_signature.exists == false or (?dll.code_signature.trusted == true and not ?dll.code_signature.subject_name : ("Microsoft Windows", "Microsoft Corporation", "Microsoft Windows Publisher"))
103 ))
104 or
105
106 /* Sysmon DLL load events */
107 ((event.category == "process" and event.action like "Image loaded*") and file.code_signature.status != "Valid" and
108 file.name : ("wlbsctrl.dll", "wbemcomn.dll", "WptsExtensions.dll", "Tsmsisrv.dll", "TSVIPSrv.dll", "Msfte.dll", "wow64log.dll", "WindowsCoreDeviceInfo.dll", "Ualapi.dll", "wlanhlp.dll", "phoneinfo.dll", "EdgeGdi.dll", "cdpsgshims.dll", "windowsperformancerecordercontrol.dll", "diagtrack_win.dll", "TPPCOIPW32.dll", "tpgenlic.dll", "thinmon.dll", "fxsst.dll", "msTracer.dll") and
109 not file.hash.sha256 in
110 ("6e837794fc282446906c36d681958f2f6212043fc117c716936920be166a700f",
111 "b14e4954e8cca060ffeb57f2458b6a3a39c7d2f27e94391cbcea5387652f21a4",
112 "c258d90acd006fa109dc6b748008edbb196d6168bc75ace0de0de54a4db46662",
113 "254e5053ac04b7623e86234077876388e0b10c3ac5c3f4e4e86292b62571bfb0"))
114
115) and not
116 (
117 ?dll.path : (
118 "?:\\Windows\\System32\\wbemcomn.dll",
119 "?:\\Windows\\SysWOW64\\wbemcomn.dll",
120 "?:\\Windows\\System32\\windowsperformancerecordercontrol.dll",
121 "?:\\Windows\\System32\\wlanhlp.dll",
122 "\\Device\\HarddiskVolume?\\Windows\\SysWOW64\\wbemcomn.dll",
123 "\\Device\\HarddiskVolume?\\Windows\\System32\\wbemcomn.dll",
124 "\\Device\\HarddiskVolume?\\Windows\\SysWOW64\\wlanhlp.dll",
125 "\\Device\\HarddiskVolume?\\Windows\\System32\\wlanhlp.dll",
126 "\\Device\\HarddiskVolume?\\Windows\\SysWOW64\\windowsperformancerecordercontrol.dll",
127 "\\Device\\HarddiskVolume?\\Windows\\System32\\windowsperformancerecordercontrol.dll",
128 "C:\\ProgramData\\docker\\windowsfilter\\*\\Files\\Windows\\System32\\windowsperformancerecordercontrol.dll",
129 "\\Device\\vmsmb\\VSMB-{*}\\os\\windows\\system32\\*.dll",
130 "C:\\Windows\\WinSxS\\amd64_microsoft-windows-wmi-core-wbemcomn-dll_*\\wbemcomn.dll",
131 "C:\\Windows\\WinSxS\\wow64_microsoft-windows-wmi-core-wbemcomn-dll_*\\wbemcomn.dll",
132 "C:\\Windows\\WinSxS\\amd64_microsoft-windows-coresystem-wpr_*\\windowsperformancerecordercontrol.dll"
133 ) or
134
135 file.path : (
136 "?:\\Windows\\System32\\wbemcomn.dll",
137 "?:\\Windows\\SysWOW64\\wbemcomn.dll",
138 "?:\\Windows\\System32\\windowsperformancerecordercontrol.dll",
139 "?:\\Windows\\System32\\wlanhlp.dll",
140 "C:\\ProgramData\\docker\\windowsfilter\\*\\Files\\Windows\\System32\\windowsperformancerecordercontrol.dll",
141 "C:\\ProgramData\\docker\\windowsfilter\\*\\Files\\Windows\\System32\\wbemcomn.dll",
142 "\\Device\\vmsmb\\VSMB-{*}\\os\\windows\\system32\\*.dll",
143 "C:\\Windows\\WinSxS\\amd64_microsoft-windows-wmi-core-wbemcomn-dll_*\\wbemcomn.dll",
144 "C:\\Windows\\WinSxS\\wow64_microsoft-windows-wmi-core-wbemcomn-dll_*\\wbemcomn.dll"
145 ) or
146
147 ?dll.code_signature.status like "errorCode_endpoint*"
148 )
149'''
150
151
152[[rule.threat]]
153framework = "MITRE ATT&CK"
154[[rule.threat.technique]]
155id = "T1574"
156name = "Hijack Execution Flow"
157reference = "https://attack.mitre.org/techniques/T1574/"
158[[rule.threat.technique.subtechnique]]
159id = "T1574.001"
160name = "DLL"
161reference = "https://attack.mitre.org/techniques/T1574/001/"
162
163
164
165[rule.threat.tactic]
166id = "TA0004"
167name = "Privilege Escalation"
168reference = "https://attack.mitre.org/tactics/TA0004/"
169[[rule.threat]]
170framework = "MITRE ATT&CK"
171[[rule.threat.technique]]
172id = "T1036"
173name = "Masquerading"
174reference = "https://attack.mitre.org/techniques/T1036/"
175[[rule.threat.technique.subtechnique]]
176id = "T1036.001"
177name = "Invalid Code Signature"
178reference = "https://attack.mitre.org/techniques/T1036/001/"
179
180
181
182[rule.threat.tactic]
183id = "TA0005"
184name = "Defense Evasion"
185reference = "https://attack.mitre.org/tactics/TA0005/"
186[[rule.threat]]
187framework = "MITRE ATT&CK"
188[[rule.threat.technique]]
189id = "T1574"
190name = "Hijack Execution Flow"
191reference = "https://attack.mitre.org/techniques/T1574/"
192[[rule.threat.technique.subtechnique]]
193id = "T1574.001"
194name = "DLL"
195reference = "https://attack.mitre.org/techniques/T1574/001/"
196
197
198
199[rule.threat.tactic]
200id = "TA0003"
201name = "Persistence"
202reference = "https://attack.mitre.org/tactics/TA0003/"
Triage and analysis
Investigating Suspicious DLL Loaded for Persistence or Privilege Escalation
Attackers can execute malicious code by abusing missing modules that processes try to load, enabling them to escalate privileges or gain persistence. This rule identifies the loading of a non-Microsoft-signed DLL that is missing on a default Windows installation or one that can be loaded from a different location by a native Windows process.
Possible investigation steps
- Examine the DLL signature and identify the process that created it.
- Investigate any abnormal behaviors by the process such as network connections, registry or file modifications, and any spawned child processes.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Retrieve the DLL and determine if it is malicious:
- Use a private sandboxed malware analysis system to perform analysis.
- Observe and collect information about the following activities:
- Attempts to contact external domains and addresses.
- File and registry access, modification, and creation activities.
- Service creation and launch activities.
- Scheduled task creation.
- Observe and collect information about the following activities:
- Use the PowerShell Get-FileHash cmdlet to get the files' SHA-256 hash values.
- Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
- Use a private sandboxed malware analysis system to perform analysis.
False positive analysis
- This activity is unlikely to happen legitimately. Any activity that triggered the alert and is not inherently malicious must be monitored by the security team.
Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
- Implement temporary network rules, procedures, and segmentation to contain the malware.
- Stop suspicious processes.
- Immediately block the identified indicators of compromise (IoCs).
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
References
Related rules
- Suspicious WerFault Child Process
- Unusual Persistence via Services Registry
- Bypass UAC via Event Viewer
- Potential privilege escalation via CVE-2022-38028
- Suspicious Startup Shell Folder Modification