T1055.008 Microsoft Sentinel · KQL

Detect Ptrace System Calls in Microsoft Sentinel

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.

MITRE ATT&CK

Tactic
Defense Evasion Privilege Escalation
Technique
T1055 Process Injection
Sub-technique
T1055.008 Ptrace System Calls
Canonical reference
https://attack.mitre.org/techniques/T1055/008/

KQL Detection Query

Microsoft Sentinel (KQL)
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

Detects ptrace system calls logged via Linux audit subsystem (auditd) or kernel messages in Syslog. Filters out common legitimate debuggers (gdb, strace, ltrace) to focus on unexpected ptrace usage that may indicate process injection. On Linux, ptrace PTRACE_ATTACH is the primary mechanism for debugger-based injection.

Data Sources

Process: OS API ExecutionProcess: Process AccessLinux auditdSyslog

Required Tables

Syslog

False Positives & Tuning

  • 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
Download portable Sigma rule (.yml)

Other platforms for T1055.008


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.

  1. Test 1Ptrace Attachment via strace

    Expected signal: auditd: SYSCALL type with syscall=101, a0=16 (PTRACE_ATTACH), a1=<target_pid>, exe=/usr/bin/strace. /proc/<target_pid>/status will show TracerPid=<strace_pid> while attached.

  2. Test 2Ptrace Memory Read via /proc/pid/mem

    Expected signal: auditd: open() syscall on /proc/<pid>/maps. If ptrace is used: SYSCALL with syscall=101. The /proc/pid/maps read itself may be logged by auditd file access rules.

  3. Test 3Check ptrace_scope Kernel Setting

    Expected signal: No security telemetry — this is a configuration check. The output shows the current ptrace restriction level.

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