DLL Injection

From ATT&CK
Jump to: navigation, search
DLL Injection
Technique
ID T1055
Tactic Defense Evasion, Privilege Escalation
Platform Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows XP, Windows 7, Windows 8, Windows Server 2003 R2, Windows Server 2008 R2, Windows Server 2012 R2, Windows Vista, Windows 8.1
Permissions Required User, Administrator, SYSTEM
Effective Permissions User, Administrator, SYSTEM
Data Sources API monitoring, Windows Registry, File monitoring, Process monitoring
Defense Bypassed Process whitelisting, Anti-virus

DLL injection is used to run code in the context of another process by causing the other process to load and execute code. Running code in the context of another process provides adversaries many benefits, such as access to the process's memory and permissions. It also allows adversaries to mask their actions under a legitimate process. A more sophisticated kind of DLL injection, reflective DLL injection, loads code without calling the normal Windows API calls, potentially bypassing DLL load monitoring. Numerous methods of DLL injection exist on Windows, including modifying the Registry, creating remote threads, Windows hooking APIs, and DLL pre-loading.12

Examples

  • 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).3
  • Taidoor can perform DLL loading.4
  • PoisonIvy can load DLLs.5
  • Sykipot injects itself into running instances of outlook.exe, iexplore.exe, or firefox.exe.6
  • 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).7
  • JHUHUGIT performs code injection injecting its own functions to browser processes.8
  • 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.9
  • Elise injects DLL files into iexplore.exe.10
  • Emissary injects its DLL file into a newly spawned Internet Explorer process.11
  • BlackEnergy injects its DLL component into svchost.exe.12
  • Backdoor.Oldrea injects itself into explorer.exe.13
  • Remsec can perform DLL injection.14
  • HIDEDRV injects a DLL for Downdelph into the explorer.exe process.15

Mitigation

Mitigating specific API calls will likely have unintended side effects, such as preventing legitimate software from operating properly. Efforts should be focused on preventing adversary tools from running earlier in the chain of activity and on identification of subsequent malicious behavior.

Identify or block potentially malicious software that may contain DLL injection functionality by using whitelisting16 tools, like AppLocker,1718 or Software Restriction Policies19 where appropriate.20

Detection

Monitoring 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. API calls such as CreateRemoteThread and those that can be used to modify memory within another process, such as WriteProcessMemory, may be used for this technique.

Monitor processes and command-line arguments for actions that could be done before or after code injection has occurred and correlate the information with related event information. Code injection may also be performed using PowerShell with tools such as PowerSploit,21 so additional PowerShell monitoring may be required to cover known implementations of this behavior.

References