Install any skill in seconds. Free to start, no credit card required.
Get Started Free →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.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 84% | 0% |
| case-07 | ✗→✓ | ▲ Improved | -36% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 93% | 0% |
| case-15 | ✗→✓ | ▲ Improved | -34% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 20% | 0% |
> Sub-technique of: T1055
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. Ptrace system call injection is commonly performed by writing arbitrary code into a running process (ex: <code>malloc</code>) then invoking that memory with <code>PTRACE_SETREGS</code> to set the register containing the next instruction to execute. Ptrace system call injection can also be done with <code>PTRACE_POKETEXT</code>/<code>PTRACE_POKEDATA</code>, which copy data to a specific address in the target processes’ memory (ex: the current address of the next instruction).
Ptrace system call injection may not be possible targeting processes that are non-child processes and/or have higher-privileges.
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
> Note: No Atomic Red Team tests available for this technique. See Atomic Red Team GitHub for updates.
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.
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.
| Finding | Severity | Impact | | ---------------------------------------- | -------- | --------------- | | Ptrace System Calls technique applicable | High | Defense Evasion |
| CWE ID | Title | | ------- | ---------------------------- | | CWE-693 | Protection Mechanism Failure |
Other measured skills in the registry, with their headline benchmark lift.