Detect Break Process Trees in Elastic Security
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 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.
MITRE ATT&CK
- Tactic
- Defense Evasion
- Technique
- T1036 Masquerading
- Sub-technique
- T1036.009 Break Process Trees
- Canonical reference
- https://attack.mitre.org/techniques/T1036/009/
Elastic Detection Query
sequence by host.name, user.name with maxspan=10s
[process where event.type == "start" and
host.os.type == "linux" and
process.parent.pid != 1 and
not process.name in ("systemd", "init", "cron", "crond", "atd", "sshd", "dockerd", "containerd", "runc")]
[process where event.type == "start" and
host.os.type == "linux" and
process.parent.pid == 1 and
not process.name in ("systemd", "init", "cron", "crond", "atd", "sshd", "dockerd", "containerd", "containerd-shim", "NetworkManager", "rsyslogd", "dbus-daemon", "polkitd", "accounts-daemon", "agetty", "login")] Detects the double-fork process tree breaking pattern on Linux by sequencing a process spawn from a non-daemon parent followed within 10 seconds by a child process adopted by PID 1 (init/systemd). This indicates the use of consecutive fork() calls or the daemon() syscall to orphan a process and evade parent-child chain correlation in EDR and SIEM tooling.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate software that uses the POSIX double-fork convention for proper daemonization on startup (e.g., custom enterprise monitoring agents, legacy Unix services) will appear as a process reparented to PID 1 and may not be in the exclusion list.
- Container runtimes such as containerd-shim and runc spawn managed container processes that can appear as direct children of init, especially in Kubernetes node environments.
- System automation tools like Ansible, Puppet, or Chef that run tasks via nohup or disown to background processes will produce process reparenting events that match this sequence pattern.
Other platforms for T1036.009
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Double Fork Process Tree Break
Expected signal: Auditd SYSCALL records for fork/clone syscalls (57/56) from bash. The resulting 'sleep 120' process will show PPID=1 in process listings. Syslog may record the orphaned process adoption.
- Test 2Daemon Syscall via Python
Expected signal: Auditd SYSCALL records for fork (57) and setsid (112) syscalls from python3. The grandchild python3 process will show PPID=1 and a new session ID (SID) in process status. /proc/<pid>/status will show PPid=1.
- Test 3Nohup Background Process Detachment
Expected signal: Auditd SYSCALL records for fork/clone from bash, followed by the nohup process. The sleep process may show PPID=1 after the parent shell exits. Process creation event from Sysmon for Linux (if deployed) shows nohup spawning sleep.
References (7)
- https://attack.mitre.org/techniques/T1036/009/
- https://0xjet.github.io/3OHA/2022/04/11/post.html
- https://sandflysecurity.com/blog/bpfdoor-an-evasive-linux-backdoor-technical-analysis/
- https://www.microsoft.com/en-us/security/blog/2022/05/19/rise-in-xorddos-a-deeper-look-at-the-stealthy-ddos-malware-targeting-linux-devices/
- https://man7.org/linux/man-pages/man2/fork.2.html
- https://man7.org/linux/man-pages/man3/daemon.3.html
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1036.009/T1036.009.md
Unlock Pro Content
Get the full detection package for T1036.009 including response playbook, investigation guide, and atomic red team tests.