T1055: 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.

Positive Technologies products that cover the technique

MaxPatrol SIEM knowledge base

mitre_attck_execution: PT-CR-1908: Execute_Over_WER_Service: Attackers can exploit a WER service vulnerability that allows spoofing an executable file and running an attackers' file with system privileges mitre_attck_defense_evasion: PT-CR-1207: DirtyVanity_Process_Injection: An attempt to bypass EDR using the Dirty Vanity utility is detected mitre_attck_defense_evasion: PT-CR-780: Process_Herpaderping_Injection: The use of Herpaderping was detected. Herpaderping is a method of bypassing antivirus and security tools by modifying the content of a file after it has been mapped into memory, but before the first thread is initiated mitre_attck_cred_access: PT-CR-767: Failed_LSASS_Injection: A system reboot caused by lsass.exe is detected hacking_tools: PT-CR-349: Cobalt_Strike_Assembly: Possible use of Cobalt Strike software hacking_tools: PT-CR-751: Cobalt_Strike_Process_Injection: Injection into a process on behalf of the rundll32.exe process hacking_tools: PT-CR-1355: Sliver_GetSystem: Remote execution of the Sliver GetSystem command from the C2 framework Sliver is detected

Subtechniques

Expert Required. The technique is detected only with the combination of «PT Product + Expert»

Detection

IDDS0009Data source and componentProcess: Process AccessDescription

Monitor for processes being viewed that may inject code into processes in order to evade process-based defenses as well as possibly elevate privileges.

IDDS0022Data source and componentFile: File MetadataDescription

Monitor for contextual data about a file, which may include information such as name, the content (ex: signature, headers, or data/media), user/owner, permissions, etc.

IDDS0009Data source and componentProcess: Process ModificationDescription

Monitor for changes made to processes that may inject code into processes in order to evade process-based defenses as well as possibly elevate privileges.

IDDS0022Data source and componentFile: File ModificationDescription

Monitor for changes made to files that may inject code into processes in order to evade process-based defenses as well as possibly elevate privileges.

IDDS0009Data source and componentProcess: Process MetadataDescription

Monitor for process memory inconsistencies, such as checking memory ranges against a known copy of the legitimate module.

IDDS0009Data source and componentProcess: OS API ExecutionDescription

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. 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.

IDDS0011Data source and componentModule: Module LoadDescription

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.

Mitigation

IDM1026NamePrivileged Account ManagementDescription

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.

IDM1040NameBehavior Prevention on EndpointDescription

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. For example, on Windows 10, Attack Surface Reduction (ASR) rules may prevent Office applications from code injection.