Process Injection

October 2, 2024 · View on GitHub

ID E1055
Objective(s) Defense Evasion, Privilege Escalation
Related ATT&CK Techniques Process Injection (T1055, T1631)
Version 2.2
Created 1 August 2019
Last Modified 28 April 2024

Process Injection

Malware may execute code in the address space of a separate process.

See ATT&CK: Process Injection (T1055, T1631).

The methods table includes existing ATT&CK sub-techniques, which have been enhanced with malware-specific details, as well as new methods. Note that IAT hooking and inline hooking (aka userland rootkits) are defined as methods under the Hijack Execution Flow behavior.

Methods

NameIDDescription
Dynamic-link Library InjectionE1055.001(Enhanced ATT&CK sub-technique) Malware creates a thread using CreateRemoteThread (or NtCreateThreadEx, RtlCreateUserThread) and LoadLibrary. The path to the malware's malicious dynamic-link library (DLL) is written in the virtual address space of another process; the malware ensures the remote process loads it by creating a remote thread in the target process. This is one of the most common process injection methods, called Classic DLL Injection via CreateRemoteThread and LoadLibrary in [1]. This method is related to Unprotect technique U1226.
Portable Executable InjectionE1055.002(Enhanced ATT&CK sub-technique) Malware copies its malicious code into an existing open process and causes it to execute via shellcode or by calling CreateRemoteThread (instead of passing the address of the LoadLibrary), called Portable Executable Injection in [1]. This method is related to Unprotect technique U1216.
Thread Execution HijackingE1055.003(Enhanced ATT&CK sub-technique) Malware targets an existing thread of a process, avoiding noisy process or thread creations operations, called Thread Execution Hijacking in [1]. This method is related to Unprotect technique U1223.
Asynchronous Procedure CallE1055.004(Enhanced ATT&CK sub-technique) Malware may leverage Asynchronous Procedure Calls (APC) to force another thread to execute its code by attaching it to the APC Queue of the target thread (using QueueUserAPC / NtQueueApcThread). AtomBombing [1][3], a variant of APC injection, occurs when the attacker stores malicious code in the global atom table. The APC gets the targeted process to retrieve the code that will be injected to the memory of the targeted process. This method is related to Unprotect technique U1221 and U1220.
Extra Window Memory InjectionE1055.011(Enhanced ATT&CK sub-technique) Malware may inject into Explorer tray window’s extra window memory, called Extra Window Memory Injection in [1]. This method is related to Unprotect technique U1219.
Process HollowingE1055.012(Enhanced ATT&CK sub-technique) Instead of injecting code into a program, malware can upmap (hollow out) legitimate code from memory of a target process, overwriting it with a malicious executable, called Process Hollowing in [1]. This method is related to Unprotect technique U1225.
Hook Injection via SetWindowsHooksExE1055.m01Malware can leverage hooking functionality to have its malicious DLL loaded upon an event getting triggered in a specific thread, which is usually done by calling SetWindowsHookEx to install a hook routine into the hook chain. [1] This method is related to Unprotect technique 1227.
Injection and Persistence via Registry ModificationE1055.m02Malware may insert the location of its malicious library under a registry key (e.g., Appinit_DLL, AppCertDlls, IFEO) to have another process load its library. [1]
Injection via Windows FibersE1055.m05Malware executes shellcode via Windows fibers by converting a thread to a fiber. [5]
Injection using ShimsE1055.m03Malware may use shims to target an executable (shims are a way of hooking into APIs and targeting specific executables and are provided by Microsoft for backward compatibility, allowing developers to apply program fixes without rewriting code). [1] This method is related to Unprotect technique U1218.
Patch Process Command LineE1055.m04Malware patches the PEB of a process to spoof the arguments.

Use in Malware

NameDateMethodDescription
UP0072016E1055.001The malware loads multiple DLLs into memory. [4]
TrickBot2016--The malware injects itself into svchost.exe. [11]
Poison Ivy2005--Poison Ivy code is injected into explorer.exe. [2]
WebCobra2018--The malware injects miner code into a running process. [12]
CryptoWall2014--The malware injects code into a new svchost process. [6]
Hupigon2013--The malware injects itself into processes such as cmd.exe and notepad.exe [7]
Hupigon2013E1055.012The malware uses process replacement. [13]
BlackEnergy2007E1055.m05BlackEnergy bypasses UAC using a Shim Database instructing SndVol.exe to execute cmd.exe instead, allowing for elevated execution. [8]
BlackEnergy2007--BlackEnergy injects its dll component into svchost.exe. [8]
Stuxnet2010E1055.001Stuxnet injects the entire DLL into another process and then just calls the particular export. [9]
Stuxnet2010E1055.m02Stuxnet uses Mrxcls.sys driver for persistence. It is registered as a boot start service by creating the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRxCIs"ImagePath" = "%System%\drivers\mrxcls.sys". [9]
Netwalker2020E1055.001Netwalker uses reflective DLL loading to inject from memory. [10]
DNSChanger2011--The malware can attach user process memory. [13]
Redhip2011E1055.003The malware can inject threads. [13]
Conti2019E1055.012Conti creates a process in a suspended state and unmaps or removes the PE image layout from a given process space.

Detection

Tool: capaMappingAPIs
patch process command lineProcess Injection::Patch Process Command Line (E1055.m04)VirtualProtect, GetProcAddress, ReadProcessMemory
attach user process memoryProcess Injection (E1055)ntoskrnl.KeStackAttachProcess, ntoskrnl.KeUnstackDetachProcess
inject shellcode using extra window memoryProcess Injection (E1055)SetWindowLong, SetWindowLongPtr, PostMessage, SendNotifyMessage
inject shellcode using a file mapping objectProcess Injection (E1055)CreateFileMapping, MapViewOfFile, MapViewOfFileNuma2
inject shellcode using window subclass procedureProcess Injection (E1055)user32.SetProp, PostMessage, SendNotifyMessage
execute shellcode via Windows fibersProcess Injection::Injection via Windows Fibers (E1055.m05)ConvertThreadToFiber, CreateFiber, SwitchToFiber
Tool: CAPEMappingAPIs
volatility_handles_1Process Injection (E1055)--
volatility_ldrmodules_1Process Injection (E1055)--
volatility_ldrmodules_2Process Injection (E1055)--
volatility_malfind_1Process Injection (E1055)--
volatility_malfind_2Process Injection (E1055)--
volatility_modscan_1Process Injection (E1055)--
injection_explorerProcess Injection (E1055)NtReadVirtualMemory, NtWow64ReadVirtualMemory64, NtOpenProcess, FindWindowExA, SendNotifyMessageW, SendNotifyMessageA, NtCreateSection, SetWindowLongA, SetWindowLongW, FindWindowA, FindWindowW, FindWindowExW, ReadProcessMemory, SetWindowLongPtrA, NtOpenSection, SetWindowLongPtrW
injection_themeinitapihookProcess Injection (E1055)ThemeInitApiHook
explorer_httpProcess Injection (E1055)WinHttpConnect, WinHttpOpenRequest
injection_createremotethreadProcess Injection (E1055)--
doppelgangingProcess Injection (E1055)--
injection_inter_processProcess Injection (E1055)--
injection_create_remote_threadProcess Injection (E1055)--
injection_process_hollowingProcess Injection (E1055)--
transacted_hollowingProcess Injection (E1055)NtRollbackTransaction, NtMapViewOfSection, RtlSetCurrentTransaction
persistence_ifeoProcess Injection (E1055)--
persistence_ifeoProcess Injection::Injection and Persistence via Registry Modification (E1055.m02)--
persistence_silent_process_exitProcess Injection (E1055)--
injection_rwxProcess Injection (E1055)VirtualProtectEx, NtAllocateVirtualMemory, NtProtectVirtualMemory
persistence_shim_databaseProcess Injection::Injection using Shims (E1055.m03)--
injection_runpeProcess Injection (E1055)--

References

[1] Ashkan Hosseini, Ten Process Injection Techniques: A Technical Survey of Common and Trending Process Injection Techniques, July 2017. https://www.elastic.co/blog/ten-process-injection-techniques-technical-survey-common-and-trending-process

[2] https://www.mandiant.com/sites/default/files/2021-09/rpt-poison-ivy.pdf

[3] https://github.com/LordNoteworthy/al-khaser

[4] https://citizenlab.ca/2016/04/between-hong-kong-and-burma/

[5] https://www.ired.team/offensive-security/code-injection-process-injection/executing-shellcode-with-createfiber

[6] https://news.sophos.com/en-us/2015/12/17/the-current-state-of-ransomware-cryptowall/

[7] https://www.f-secure.com/v-descs/backdoor_w32_hupigon.shtml

[8] https://blog-assets.f-secure.com/wp-content/uploads/2019/10/15163408/BlackEnergy_Quedagh.pdf

[9] https://docs.broadcom.com/doc/security-response-w32-stuxnet-dossier-11-en

[10] https://www.trendmicro.com/en_us/research/20/e/netwalker-fileless-ransomware-injected-via-reflective-loading.html

[11] https://www.cybereason.com/blog/research/dropping-anchor-from-a-trickbot-infection-to-the-discovery-of-the-anchor-malware

[12] https://www.mcafee.com/blogs/other-blogs/mcafee-labs/webcobra-malware-uses-victims-computers-to-mine-cryptocurrency/

[13] capa v4.0, analyzed at MITRE on 10/12/2022