Adversaries may inject dynamic-link libraries (DLLs) into processes in order to evade process-based defenses as well as possibly elevate privileges. DLL injection is a method of executing arbitrary code in the address space of a separate live process.
DLL injection is commonly performed by writing the path to a DLL in the virtual address space of the target process before loading the DLL by invoking a new thread. The write can be performed with native Windows API calls such as VirtualAllocEx
and WriteProcessMemory
, then invoked with CreateRemoteThread
(which calls the LoadLibrary
API responsible for loading the DLL). [1]
Variations of this method such as reflective DLL injection (writing a self-mapping DLL into a process) and memory module (map DLL when writing into process) overcome the address relocation issue as well as the additional APIs to invoke execution (since these methods load and execute the files in memory by manually preforming the function of LoadLibrary
).[2][1]
Another variation of this method, often referred to as Module Stomping/Overloading or DLL Hollowing, may be leveraged to conceal injected code within a process. This method involves loading a legitimate DLL into a remote process then manually overwriting the module's AddressOfEntryPoint
before starting a new thread in the target process.[3] This variation allows attackers to hide malicious injected code by potentially backing its execution with a legitimate DLL file on disk.[4]
Running code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via DLL injection may also evade detection from security products since the execution is masked under a legitimate process.
ID | Name | Description |
---|---|---|
S0456 | Aria-body |
Aria-body has the ability to inject itself into another process such as rundll32.exe and dllhost.exe.[5] |
G0135 | BackdoorDiplomacy |
BackdoorDiplomacy has dropped legitimate software onto a compromised host and used it to execute malicious DLLs.[6] |
S1081 | BADHATCH |
BADHATCH has the ability to execute a malicious DLL by injecting into |
S0089 | BlackEnergy |
BlackEnergy injects its DLL component into svchost.exe.[8] |
S1039 | Bumblebee |
The Bumblebee loader can support the |
C0015 | C0015 |
During C0015, the threat actors used a DLL named |
S0484 | Carberp |
Carberp's bootkit can inject a malicious DLL into the address space of running processes.[12] |
S0335 | Carbon | |
S0154 | Cobalt Strike |
Cobalt Strike has the ability to load DLLs via reflective injection.[14][15] |
S0126 | ComRAT |
ComRAT has injected its orchestrator DLL into explorer.exe. ComRAT has also injected its communications module into the victim's default browser to make C2 connections appear less suspicious as all network connections will be initiated by the browser process.[16][17] |
S0575 | Conti |
Conti has loaded an encrypted DLL into memory and then executes it.[18][19] |
S1066 | DarkTortilla |
DarkTortilla can use a .NET-based DLL named |
S0021 | Derusbi |
Derusbi injects itself into the secure shell (SSH) process.[21] |
S0038 | Duqu |
Duqu will inject itself into different processes to evade detection. The selection of the target process is influenced by the security software that is installed on the system (Duqu will inject into different processes depending on which security suite is installed on the infected host).[22] |
S0024 | Dyre | |
S0081 | Elise | |
S0082 | Emissary |
Emissary injects its DLL file into a newly spawned Internet Explorer process.[26] |
S0367 | Emotet |
Emotet has been observed injecting in to Explorer.exe and other processes. [27][28][29] |
S0182 | FinFisher |
FinFisher injects itself into various processes depending on whether it is low integrity or high integrity.[30][31] |
S1044 | FunnyDream |
The FunnyDream FilepakMonitor component can inject into the Bka.exe process using the |
S0666 | Gelsemium |
Gelsemium has the ability to inject DLLs into specific processes.[33] |
S0460 | Get2 | |
S1027 | Heyoka Backdoor |
Heyoka Backdoor can inject a DLL into rundll32.exe for execution.[35] |
S0135 | HIDEDRV |
HIDEDRV injects a DLL for Downdelph into the explorer.exe process.[36] |
S0581 | IronNetInjector |
IronNetInjector has the ability to inject a DLL into running processes, including the IronNetInjector DLL into explorer.exe.[37] |
S0265 | Kazuar |
If running in a Windows environment, Kazuar saves a DLL to disk that is injected into the explorer.exe process to execute the payload. Kazuar can also be configured to inject and execute within specific processes.[38] |
S0250 | Koadic |
Koadic can perform process injection by using a reflective DLL.[39] |
G0032 | Lazarus Group |
A Lazarus Group malware sample performs reflective DLL injection.[40][41] |
G0065 | Leviathan |
Leviathan has utilized techniques like reflective DLL loading to write a DLL into memory and load a shell that provides backdoor access to the victim.[42] |
S0681 | Lizar |
Lizar has used the PowerKatz plugin that can be loaded into the address space of a PowerShell process through reflective DLL loading.[43] |
G1026 | Malteiro | |
S0167 | Matryoshka |
Matryoshka uses reflective DLL injection to inject the malicious library and execute the RAT.[45] |
S0449 | Maze |
Maze has injected the malware DLL into a target process.[46][47] |
S0576 | MegaCortex |
MegaCortex loads |
S0455 | Metamorfo |
Metamorfo has injected a malicious DLL into the Windows Media Player process (wmplayer.exe).[49] |
S1026 | Mongall |
Mongall can inject a DLL into |
S0457 | Netwalker |
The Netwalker DLL has been injected reflectively into the memory of a legitimate running process.[50] |
S0501 | PipeMon |
PipeMon can inject its modules into various processes using reflective DLL loading.[51] |
S0012 | PoisonIvy |
PoisonIvy can inject a malicious DLL into a process.[52][53] |
S0194 | PowerSploit |
PowerSploit contains a collection of CodeExecution modules that inject code (DLL, shellcode) into a process.[54][55] |
S0613 | PS1 | |
S0192 | Pupy |
Pupy can migrate into another process using reflective DLL injection.[57] |
G0024 | Putter Panda |
An executable dropped onto victims by Putter Panda aims to inject the specified DLL into a process that would normally be accessing the network, including Outlook Express (msinm.exe), Outlook (outlook.exe), Internet Explorer (iexplore.exe), and Firefox (firefox.exe).[58] |
S0458 | Ramsay |
Ramsay can use |
S0055 | RARSTONE |
After decrypting itself in memory, RARSTONE downloads a DLL file from its C2 server and loads it in the memory space of a hidden Internet Explorer process. This "downloaded" file is actually not dropped onto the system.[60] |
S0241 | RATANKBA |
RATANKBA performs a reflective DLL injection using a given pid.[61][62] |
S0125 | Remsec | |
S1018 | Saint Bot |
Saint Bot has injected its DLL component into |
S0461 | SDBbot |
SDBbot has the ability to inject a downloaded DLL into a newly created rundll32.exe process.[34] |
S0596 | ShadowPad | |
S0273 | Socksbot |
Socksbot creates a suspended svchost process and injects its DLL into it.[66] |
S0615 | SombRAT |
SombRAT can execute |
S0603 | Stuxnet |
Stuxnet injects an entire DLL into an existing, newly created, or preselected trusted process.[67] |
S0018 | Sykipot |
Sykipot injects itself into running instances of outlook.exe, iexplore.exe, or firefox.exe.[68] |
G0092 | TA505 | |
S0011 | Taidoor | |
S0467 | TajMahal |
TajMahal has the ability to inject DLLs for malicious plugins into running processes.[72] |
G0081 | Tropic Trooper |
Tropic Trooper has injected a DLL backdoor into dllhost.exe and svchost.exe.[73][74] |
G0010 | Turla |
Turla has used Metasploit to perform reflective DLL injection in order to escalate privileges.[75][76] |
S0022 | Uroburos |
Uroburos can use DLL injection to load embedded files and modules.[77] |
G0102 | Wizard Spider |
Wizard Spider has injected malicious DLLs into memory with read, write, and execute permissions.[78][79] |
S0412 | ZxShell |
ID | Mitigation | Description |
---|---|---|
M1040 | Behavior Prevention on Endpoint |
Some endpoint security solutions can be configured to block some types of process injection based on common sequences of behavior that occur during the injection process. |
ID | Data Source | Data Component | Detects |
---|---|---|---|
DS0011 | Module | Module Load |
Monitor DLL/PE file events, specifically creation of these binary files as well as the loading of DLLs into processes. Look for DLLs that are not recognized or not normally loaded into a process. Sysmon Event ID 7 (Image loaded) can be used to monitor the loading of DLLs into processes. This is a particularly noisy event and can generate a large volume of data, so we recommend baselining and filtering out any known benign processes and module loads to help reduce the number of events that are produced. |
DS0009 | Process | OS API Execution |
Monitoring Windows API calls indicative of the various types of code injection may generate a significant amount of data and may not be directly useful for defense unless collected under specific circumstances for known bad sequences of calls, since benign use of API functions may be common and difficult to distinguish from malicious behavior. Windows API calls such as Search for remote thread creations that start at LoadLibraryA or LoadLibraryW. Depending on the tool, it may provide additional information about the DLL string that is an argument to the function. If there is any security software that legitimately injects DLLs, it must be carefully whitelisted. Microsoft Windows allows for processes to remotely create threads within other processes of the same privilege level. This functionality is provided via the Windows API CreateRemoteThread. Both Windows and third-party software use this ability for legitimate purposes. For example, the Windows process csrss.exe creates threads in programs to send signals to registered callback routines. Both adversaries and host-based security software use this functionality to inject DLLs, but for very different purposes. An adversary is likely to inject into a program to evade defenses or bypass User Account Control, but a security program might do this to gain increased monitoring of API calls. One of the most common methods of DLL Injection is through the Windows API LoadLibrary.
This behavior can be detected by looking for thread creations across processes, and resolving the entry point to determine the function name. If the function is LoadLibraryA or LoadLibraryW, then the intent of the remote thread is clearly to inject a DLL. When this is the case, the source process must be examined so that it can be ignored when it is both expected and a trusted process. |
Process Access |
Monitor for process being viewed that may inject dynamic-link libraries (DLLs) into processes in order to evade process-based defenses as well as possibly elevate privileges. |
||
Process Metadata |
Monitor for process memory inconsistencies compared to DLL files on disk by checking memory ranges against a known copy of the legitimate module.[4] |
||
Process Modification |
Monitor for changes made to processes that may inject dynamic-link libraries (DLLs) into processes in order to evade process-based defenses as well as possibly elevate privileges. Injecting a malicious DLL into a process is a common adversary TTP. Although the ways of doing this are numerous, mavinject.exe is a commonly used tool for doing so because it roles up many of the necessary steps into one, and is available within Windows. Attackers may rename the executable, so we also use the common argument "INJECTRUNNING" as a related signature here. Whitelisting certain applications may be necessary to reduce noise for this analytic. Analytic 1 - DLL Injection with Mavinject
|