Rundll32
Adversaries may abuse rundll32.exe to proxy execution of malicious code. Using rundll32.exe avoids triggering security tools that allowlist it or ignore it due to high noise. Rundll32 can execute DLL payloads, Control Panel items (.cpl via Control_RunDLL), JavaScript (via mshtml,RunHTMLApplication), remote COM scriptlets, and system DLLs (zipfldr.dll, ieframe.dll). Adversaries may also export DLL functions by ordinal number or obscure function names by appending W/A character set suffixes. Widely used by InvisiMole, Latrodectus, FIN8, APT28, BoomBox, MegaCortex, QakBot, Emotet, Cobalt Strike, and many ransomware families.
let SuspiciousDLLs = dynamic(["zipfldr.dll", "ieframe.dll", "comsvcs.dll", "shell32.dll", "advpack.dll", "shdocvw.dll"]);
let SuspiciousFunctions = dynamic(["MiniDump", "Control_RunDLL", "RunHTMLApplication", "LaunchINFSection", "OpenURL"]);
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "rundll32.exe"
| extend JavaScriptExec = ProcessCommandLine has_any ("javascript:", "mshtml", "RunHTMLApplication")
| extend RemoteSCT = ProcessCommandLine has_any ("http://", "https://", "GetObject(")
| extend MiniDump = ProcessCommandLine has "MiniDump"
| extend ControlPanel = ProcessCommandLine has_any ("Control_RunDLL", ".cpl")
| extend SuspiciousFunc = ProcessCommandLine has_any (SuspiciousFunctions)
| extend SuspiciousPath = ProcessCommandLine has_any ("Temp", "AppData", "Downloads", "Public", "Desktop")
| extend OrdinalLoad = ProcessCommandLine matches regex @",#\d+"
| extend SuspiciousParent = InitiatingProcessFileName has_any ("winword.exe", "excel.exe", "outlook.exe", "powerpnt.exe", "cmd.exe", "powershell.exe", "wscript.exe", "cscript.exe", "mshta.exe")
| where JavaScriptExec or RemoteSCT or MiniDump or (SuspiciousPath and SuspiciousParent) or SuspiciousParent
| project Timestamp, DeviceName, AccountName, ProcessCommandLine, InitiatingProcessFileName,
InitiatingProcessCommandLine, JavaScriptExec, RemoteSCT, MiniDump, ControlPanel,
SuspiciousPath, OrdinalLoad, SuspiciousParent
| sort by Timestamp desc Data Sources
Required Tables
False Positives
- Legitimate software using rundll32.exe to load and execute DLL functions from Program Files, such as printer drivers, codec installers, and application extensions
- Windows itself uses rundll32.exe for various system functions including Control Panel applets and shell extensions
- Software deployment tools (SCCM) that use rundll32.exe to trigger installation DLL entry points
- Security tools and EDR agents that may use rundll32.exe as part of their injection or hooking mechanisms
References (6)
- https://attack.mitre.org/techniques/T1218/011/
- https://lolbas-project.github.io/lolbas/Binaries/Rundll32/
- https://www.carbonblack.com/2016/04/28/threat-advisory-squiblydoo-continues-trend-of-attackers-using-native-os-tools-to-live-off-the-land/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1218.011/T1218.011.md
- https://blog.f-secure.com/hunting-for-the-undefined-behavior-the-case-of-comsvcs-dll/
- https://www.elastic.co/blog/hunting-for-persistence-using-elastic-security
Unlock Pro Content
Get the full detection package for T1218.011 including response playbook, investigation guide, and atomic red team tests.