Process Injection

Adversaries may inject code into processes in order to evade process-based defenses as well as possibly elevate privileges. Process injection is a method of executing arbitrary code in the address space of a separate live process. 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 process injection may also evade detection from security products since the execution is masked under a legitimate process.

There are many different ways to inject code into a process, many of which abuse legitimate functionalities. These implementations exist for every major OS but are typically platform specific.

More sophisticated samples may perform multiple process injections to segment modules and further evade detection, utilizing named pipes or other inter-process communication (IPC) mechanisms as a communication channel.

ID: T1055
Tactics: Defense Evasion, Privilege Escalation
Platforms: Linux, Windows, macOS
Data Sources: File: File Metadata, File: File Modification, Module: Module Load, Process: OS API Execution, Process: Process Access
Defense Bypassed: Anti-virus, Application control
CAPEC ID: CAPEC-640
Contributors: Anastasios Pingios; Christiaan Beek, @ChristiaanBeek; Ryan Becwar
Version: 1.1
Created: 31 May 2017
Last Modified: 09 February 2021

Procedure Examples

ID Name Description
S0469 ABK

ABK has the ability to inject shellcode into svchost.exe.[1]

S0331 Agent Tesla

Agent Tesla can inject into known, vulnerable binaries on targeted hosts.[2]

G0050 APT32

APT32 malware has injected a Cobalt Strike beacon into Rundll32.exe.[3]

G0067 APT37

APT37 injects its malware variant, ROKRAT, into the cmd.exe process.[4]

G0096 APT41

APT41 malware TIDYELF loaded the main WINTERLOVE component by injecting it into the iexplore.exe process.[5]

S0438 Attor

Attor's dispatcher can inject itself into running processes to gain higher privileges and to evade detection.[6]

S0347 AuditCred

AuditCred can inject code from files to other running processes.[7]

S0473 Avenger

Avenger has the ability to inject shellcode into svchost.exe.[1]

S0093 Backdoor.Oldrea

Backdoor.Oldrea injects itself into explorer.exe.[8]

S0534 Bazar

Bazar can inject code through calling VirtualAllocExNuma.[9]

S0470 BBK

BBK has the ability to inject shellcode into svchost.exe.[1]

S0348 Cardinal RAT

Cardinal RAT injects into a newly spawned process created from a native Windows executable.[10]

G0080 Cobalt Group

Cobalt Group has injected code into trusted processes.[11]

S0154 Cobalt Strike

Cobalt Strike can inject a variety of payloads into processes dynamically chosen by the adversary.[12]

S0024 Dyre

Dyre has the ability to directly inject its code into the web browser process.[13]

S0554 Egregor

Egregor can inject its payload into iexplore.exe process.[14]

S0363 Empire

Empire contains multiple modules for injecting into processes, such as Invoke-PSInject.[15]

S0168 Gazer

Gazer injects its communication module into an Internet accessible process through which it performs C2.[16][17]

S0032 gh0st RAT

gh0st RAT can inject malicious code into process created by the "Command_Create&Inject" function.[18]

G0072 Honeybee

Honeybee uses a batch file to load a DLL into the svchost.exe process.[19]

S0376 HOPLIGHT

HOPLIGHT has injected into running processes.[20]

S0040 HTRAN

HTRAN can inject into into running processes.[21]

S0398 HyperBro

HyperBro can run shellcode it injects into a newly created process.[22]

S0260 InvisiMole

InvisiMole can inject itself into another process to avoid detection including use of a technique called ListPlanting that customizes the sorting algorithm in a ListView structure.[23]

S0581 IronNetInjector

IronNetInjector can use an IronPython scripts to load a .NET injector to inject a payload into its own or a remote process.[24]

S0044 JHUHUGIT

JHUHUGIT performs code injection injecting its own functions to browser processes.[25][26]

S0201 JPIN

JPIN can inject content into lsass.exe to load a module.[27]

G0094 Kimsuky

Kimsuky has used Win7Elevate to inject malicious code into explorer.exe.[28]

S0247 NavRAT

NavRAT copies itself into a running Internet Explorer process to evade detection.[29]

S0198 NETWIRE

NETWIRE can inject code into system processes including notepad.exe, svchost.exe, and vbc.exe.[30]

G0116 Operation Wocao

Operation Wocao has injected code into a selected process, which in turn launches a command as a child process of the original.[31]

G0068 PLATINUM

PLATINUM has used various methods of process injection including hot patching.[27]

S0378 PoshC2

PoshC2 contains multiple modules for injecting into processes, such as Invoke-PSInject.[32]

S0332 Remcos

Remcos has a command to hide itself through injecting into another process.[33]

S0496 REvil

REvil can inject itself into running processes on a compromised host.[34]

S0446 Ryuk

Ryuk has injected itself into remote processes to encrypt files using a combination of VirtualAlloc, WriteProcessMemory, and CreateRemoteThread.[35]

S0596 ShadowPad

ShadowPad has injected an install module into a newly created process.[36]

G0104 Sharpshooter

Sharpshooter has leveraged embedded shellcode to inject a downloader into the memory of Word.[37]

G0091 Silence

Silence has injected a DLL library containing a Trojan into the fwmain32.exe process.[38]

S0533 SLOTHFULMEDIA

SLOTHFULMEDIA can inject into running processes on a compromised host.[39]

S0226 Smoke Loader

Smoke Loader injects into the Internet Explorer process.[40]

S0380 StoneDrill

StoneDrill has relied on injecting its payload directly into the process memory of the victim's preferred browser.[41]

S0011 Taidoor

Taidoor can perform DLL loading.[42]

S0436 TSCookie

TSCookie has the ability to inject code into the svchost.exe, iexplorer.exe, explorer.exe, and default browser processes.[43]

G0010 Turla

Turla has also used PowerSploit's Invoke-ReflectivePEInjection.ps1 to reflectively load a PowerShell payload into a random process on the victim system.[44]

S0579 Waterbear

Waterbear can inject decrypted shellcode into the LanmanServer service.[45]

S0206 Wiarp

Wiarp creates a backdoor through which remote attackers can inject files into running processes.[46]

S0176 Wingbird

Wingbird performs multiple process injections to hijack system processes and execute malicious code.[47]

Mitigations

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.

M1026 Privileged Account Management

Utilize Yama (ex: /proc/sys/kernel/yama/ptrace_scope) to mitigate ptrace based process injection by restricting the use of ptrace to privileged users only. Other mitigation controls involve the deployment of security kernel modules that provide advanced access control and process restrictions such as SELinux, grsecurity, and AppArmor.

Detection

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 CreateRemoteThread, SuspendThread/SetThreadContext/ResumeThread, QueueUserAPC/NtQueueApcThread, and those that can be used to modify memory within another process, such as VirtualAllocEx/WriteProcessMemory, may be used for this technique.[48]

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.

Monitoring for Linux specific calls such as the ptrace system call should not generate large amounts of data due to their specialized nature, and can be a very effective method to detect some of the common process injection methods.[49] [50] [51] [52]

Monitor for named pipe creation and connection events (Event IDs 17 and 18) for possible indicators of infected processes with external modules.[53]

Analyze process behavior to determine if a process is performing actions it usually does not, such as opening network connections, reading files, or other suspicious actions that could relate to post-compromise behavior.

References

  1. Chen, J. et al. (2019, November). Operation ENDTRADE: TICK’s Multi-Stage Backdoors for Attacking Industries and Stealing Classified Data. Retrieved June 9, 2020.
  2. Walter, J. (2020, August 10). Agent Tesla | Old RAT Uses New Tricks to Stay on Top. Retrieved December 11, 2020.
  3. Dahan, A. (2017). Operation Cobalt Kitty. Retrieved December 27, 2018.
  4. Mercer, W., Rascagneres, P. (2018, January 16). Korea In The Crosshairs. Retrieved May 21, 2018.
  5. Fraser, N., et al. (2019, August 7). Double DragonAPT41, a dual espionage and cyber crime operation APT41. Retrieved September 23, 2019.
  6. Hromcova, Z. (2019, October). AT COMMANDS, TOR-BASED COMMUNICATIONS: MEET ATTOR, A FANTASY CREATURE AND ALSO A SPY PLATFORM. Retrieved May 6, 2020.
  7. Trend Micro. (2018, November 20). Lazarus Continues Heists, Mounts Attacks on Financial Organizations in Latin America. Retrieved December 3, 2018.
  8. Symantec Security Response. (2014, July 7). Dragonfly: Cyberespionage Attacks Against Energy Suppliers. Retrieved April 8, 2016.
  9. Cybereason Nocturnus. (2020, July 16). A BAZAR OF TRICKS: FOLLOWING TEAM9’S DEVELOPMENT CYCLES. Retrieved November 18, 2020.
  10. Grunzweig, J.. (2017, April 20). Cardinal RAT Active for Over Two Years. Retrieved December 8, 2018.
  11. Matveeva, V. (2017, August 15). Secrets of Cobalt. Retrieved October 10, 2018.
  12. Strategic Cyber LLC. (2017, March 14). Cobalt Strike Manual. Retrieved May 24, 2017.
  13. hasherezade. (2015, November 4). A Technical Look At Dyreza. Retrieved June 15, 2020.
  14. Cybleinc. (2020, October 31). Egregor Ransomware – A Deep Dive Into Its Activities and Techniques. Retrieved December 29, 2020.
  15. Schroeder, W., Warner, J., Nelson, M. (n.d.). Github PowerShellEmpire. Retrieved April 28, 2016.
  16. ESET. (2017, August). Gazing at Gazer: Turla’s new second stage backdoor. Retrieved September 14, 2017.
  17. Kaspersky Lab's Global Research & Analysis Team. (2017, August 30). Introducing WhiteBear. Retrieved September 21, 2017.
  18. Quinn, J. (2019, March 25). The odd case of a Gh0stRAT variant. Retrieved July 15, 2020.
  19. Sherstobitoff, R. (2018, March 02). McAfee Uncovers Operation Honeybee, a Malicious Document Campaign Targeting Humanitarian Aid Groups. Retrieved May 16, 2018.
  20. US-CERT. (2019, April 10). MAR-10135536-8 – North Korean Trojan: HOPLIGHT. Retrieved April 19, 2019.
  21. The Australian Cyber Security Centre (ACSC), the Canadian Centre for Cyber Security (CCCS), the New Zealand National Cyber Security Centre (NZ NCSC), CERT New Zealand, the UK National Cyber Security Centre (UK NCSC) and the US National Cybersecurity and Communications Integration Center (NCCIC). (2018, October 11). Joint report on publicly available hacking tools. Retrieved March 11, 2019.
  22. Falcone, R. and Lancaster, T.. (2019, May 28). Emissary Panda Attacks Middle East Government Sharepoint Servers. Retrieved July 9, 2019.
  23. Hromcova, Z. and Cherpanov, A. (2020, June). INVISIMOLE: THE HIDDEN PART OF THE STORY. Retrieved July 16, 2020.
  24. Reichel, D. (2021, February 19). IronNetInjector: Turla’s New Malware Loading Tool. Retrieved February 24, 2021.
  25. F-Secure. (2015, September 8). Sofacy Recycles Carberp and Metasploit Code. Retrieved August 3, 2016.
  26. Lee, B, et al. (2018, February 28). Sofacy Attacks Multiple Government Entities. Retrieved March 15, 2018.
  27. Windows Defender Advanced Threat Hunting Team. (2016, April 29). PLATINUM: Targeted attacks in South and Southeast Asia. Retrieved February 15, 2018.
  1. Tarakanov , D.. (2013, September 11). The “Kimsuky” Operation: A North Korean APT?. Retrieved August 13, 2019.
  2. Mercer, W., Rascagneres, P. (2018, May 31). NavRAT Uses US-North Korea Summit As Decoy For Attacks In South Korea. Retrieved June 11, 2018.
  3. Lambert, T. (2020, January 29). Intro to Netwire. Retrieved January 7, 2021.
  4. Dantzig, M. v., Schamper, E. (2019, December 19). Operation Wocao: Shining a light on one of China’s hidden hacking groups. Retrieved October 8, 2020.
  5. Nettitude. (2018, July 23). Python Server for PoshC2. Retrieved April 23, 2019.
  6. Bacurio, F., Salvio, J. (2017, February 14). REMCOS: A New RAT In The Wild. Retrieved November 6, 2018.
  7. Saavedra-Morales, J, et al. (2019, October 20). McAfee ATR Analyzes Sodinokibi aka REvil Ransomware-as-a-Service – Crescendo. Retrieved August 5, 2020.
  8. Hanel, A. (2019, January 10). Big Game Hunting with Ryuk: Another Lucrative Targeted Ransomware. Retrieved May 12, 2020.
  9. Kaspersky Lab. (2017, August). ShadowPad: popular server management software hit in supply chain attack. Retrieved March 22, 2021.
  10. Sherstobitoff, R., Malhotra, A., et. al.. (2018, December 18). Operation Sharpshooter Campaign Targets Global Defense, Critical Infrastructure. Retrieved May 14, 2020.
  11. Group-IB. (2018, September). Silence: Moving Into the Darkside. Retrieved May 5, 2020.
  12. DHS/CISA, Cyber National Mission Force. (2020, October 1). Malware Analysis Report (MAR) MAR-10303705-1.v1 – Remote Access Trojan: SLOTHFULMEDIA. Retrieved October 2, 2020.
  13. Baker, B., Unterbrink H. (2018, July 03). Smoking Guns - Smoke Loader learned new tricks. Retrieved July 5, 2018.
  14. Kaspersky Lab. (2017, March 7). From Shamoon to StoneDrill: Wipers attacking Saudi organizations and beyond. Retrieved March 14, 2019.
  15. Trend Micro. (2012). The Taidoor Campaign. Retrieved November 12, 2014.
  16. Tomonaga, S.. (2019, September 18). Malware Used by BlackTech after Network Intrusion. Retrieved May 6, 2020.
  17. Faou, M. and Dumont R.. (2019, May 29). A dive into Turla PowerShell usage. Retrieved June 14, 2019.
  18. Su, V. et al. (2019, December 11). Waterbear Returns, Uses API Hooking to Evade Security. Retrieved February 22, 2021.
  19. Zhou, R. (2012, May 15). Backdoor.Wiarp. Retrieved February 22, 2018.
  20. Anthe, C. et al. (2016, December 14). Microsoft Security Intelligence Report Volume 21. Retrieved November 27, 2017.
  21. Hosseini, A. (2017, July 18). Ten Process Injection Techniques: A Technical Survey Of Common And Trending Process Injection Techniques. Retrieved December 7, 2017.
  22. Ligh, M.H. et al.. (2014, July). The Art of Memory Forensics: Detecting Malware and Threats in Windows, Linux, and Mac Memory. Retrieved December 20, 2017.
  23. GNU. (2010, February 5). The GNU Accounting Utilities. Retrieved December 20, 2017.
  24. Jahoda, M. et al.. (2017, March 14). redhat Security Guide - Chapter 7 - System Auditing. Retrieved December 20, 2017.
  25. stderr. (2014, February 14). Detecting Userland Preload Rootkits. Retrieved December 20, 2017.
  26. Russinovich, M. & Garnier, T. (2017, May 22). Sysmon v6.20. Retrieved December 13, 2017.