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

Microsoft Sentinel / Defender
kusto
// Detect ptrace-based process injection on Linux endpoints
// Monitor for ptrace system calls from non-debugger processes
Syslog
| where TimeGenerated > ago(24h)
| where Facility == "authpriv" or Facility == "auth" or Facility == "kern"
| where SyslogMessage has "ptrace" or SyslogMessage has "PTRACE"
| where SyslogMessage !has "gdb" and SyslogMessage !has "strace" and SyslogMessage !has "ltrace"
| project TimeGenerated, Computer, SyslogMessage, Facility, SeverityLevel
| sort by TimeGenerated desc
high severity medium confidence

Data Sources

Process: OS API Execution Process: Process Access Linux auditd Syslog

Required Tables

Syslog

False Positives

  • Software developers using gdb, strace, or ltrace for legitimate debugging
  • Container runtime tools (Docker, containerd) using ptrace for process namespace management
  • System administration tools performing ptrace for diagnostic purposes
  • Security scanners and vulnerability assessment tools that ptrace processes for analysis

Unlock Pro Content

Get the full detection package for T1055.008 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections