Masquerading: Break Process Trees

An adversary may attempt to evade process tree-based analysis by modifying executed malware's parent process ID (PPID). If endpoint protection software leverages the "parent-child" relationship for detection, breaking this relationship could result in the adversary’s behavior not being associated with previous process tree activity. On Unix-based systems breaking this process tree is common practice for administrators to execute software using scripts and programs.[1]

On Linux systems, adversaries may execute a series of Native API calls to alter malware's process tree. For example, adversaries can execute their payload without any arguments, call the fork() API call twice, then have the parent process exit. This creates a grandchild process with no parent process that is immediately adopted by the init system process (PID 1), which successfully disconnects the execution of the adversary's payload from its previous process tree.

Another example is using the "daemon" syscall to detach from the current parent process and run in the background.[2][3]

ID: T1036.009
Sub-technique of:  T1036
Tactic: Defense Evasion
Platforms: Linux, macOS
Contributors: Tim (Wadhwa-)Brown
Version: 1.0
Created: 27 September 2023
Last Modified: 03 October 2023

Procedure Examples

ID Name Description
S1161 BPFDoor

After initial execution, BPFDoor forks itself and runs the fork with the --init flag, which allows it to execute secondary clean up operations. The parent process terminates leaving the forked process to be inherited by the legitimate process init.[2]

Mitigations

This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.

Detection

ID Data Source Data Component Detects
DS0009 Process OS API Execution

Monitor for API calls such as fork() which can be abused to masquerade or manipulate process metadata.

Process Creation

Monitor for the abnormal creation of background processes as well as processes executing from abnormal locations, such as /dev/shm.

References