Ptrace System Calls

T1055.008

Sub-technique of T1055 Process Injection.View on attack.mitre.org

About this technique

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

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.

Detection rules0

Rules on DetectionCode tagged with T1055.008.

Sigma0

No Sigma rules are mapped to this technique yet.

Splunk0

No Splunk rules are mapped to this technique yet.

Groups0

None recorded.

Software1

Campaigns0

None recorded.

Procedure examples1

Software1

Used byProcedure example
MalwarePACEMAKER

PACEMAKER can use PTRACE to attach to a targeted process to read process memory.

References3

  1. BH Linux Inject Open source
    Colgan, T. (2015, August 15). Linux-Inject. Retrieved February 21, 2020.
  2. Medium Ptrace JUL 2018 Open source
    Jain, S. (2018, July 25). Code injection in running process using ptrace. Retrieved February 21, 2020.
  3. PTRACE man Open source
    Kerrisk, M. (2020, February 9). PTRACE(2) - Linux Programmer's Manual. Retrieved February 21, 2020.

Data from MITRE ATT&CK® (Enterprise). ATT&CK® is a registered trademark of The MITRE Corporation.