Stealth Privilege Escalation

T1055.008: Ptrace System Calls

Adversaries may inject malicious code into processes via ptrace (process trace) system calls in order to evade process-based defenses as well as possibly elevate privileges. Ptrace system call injecti...

T1055.008 · Sub-technique ·1 platforms

Description

Adversaries may inject malicious code into processes via ptrace (process trace) system calls in order to evade process-based defenses as well as possibly elevate privileges. Ptrace system call injection is a method of executing arbitrary code in the address space of a separate live process.

Ptrace system call injection involves attaching to and modifying a running process. The ptrace system call enables a debugging process to observe and control another process (and each individual thread), including changing memory and register values.(Citation: PTRACE man) Ptrace system call injection is commonly performed by writing arbitrary code into a running process (ex: malloc) then invoking that memory with PTRACE_SETREGS to set the register containing the next instruction to execute. Ptrace system call injection can also be done with PTRACE_POKETEXT/PTRACE_POKEDATA, which copy data to a specific address in the target processes’ memory (ex: the current address of the next instruction). (Citation: PTRACE man)(Citation: Medium Ptrace JUL 2018)

Ptrace system call injection may not be possible targeting processes that are non-child processes and/or have higher-privileges.(Citation: BH Linux Inject)

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 ptrace system call injection may also evade detection from security products since the execution is masked under a legitimate process.

Platforms

Linux

Mitigations (2)

Behavior Prevention on EndpointM1040

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.

Privileged Account ManagementM1026

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.

Associated Software (1)

IDNameTypeContext
S1109PACEMAKERMalware[PACEMAKER](https://attack.mitre.org/software/S1109) can use PTRACE to attach to a targeted process to read process memory.(Citation: Mandiant Pulse S...

Related CWE Weaknesses

References

Frequently Asked Questions

What is T1055.008 (Ptrace System Calls)?

T1055.008 is a MITRE ATT&CK technique named 'Ptrace System Calls'. It belongs to the Stealth, Privilege Escalation tactic(s). Adversaries may inject malicious code into processes via ptrace (process trace) system calls in order to evade process-based defenses as well as possibly elevate privileges. Ptrace system call injecti...

How can T1055.008 be detected?

Detection of T1055.008 (Ptrace System Calls) typically involves monitoring system logs, network traffic, and endpoint telemetry. Use SIEM rules, EDR solutions, and behavioral analytics to identify suspicious activity associated with this technique.

What mitigations exist for T1055.008?

There are 2 documented mitigations for T1055.008. Key mitigations include: Behavior Prevention on Endpoint, Privileged Account Management.

Which threat groups use T1055.008?

While specific threat group attribution may vary, this technique has been observed in various real-world attacks. Check the MITRE ATT&CK website for the latest threat intelligence.