T1055.008 Splunk · SPL

Detect Ptrace System Calls in Splunk

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/

SPL Detection Query

Splunk (SPL)
spl
index=linux sourcetype="linux:audit" type=SYSCALL syscall=101
| eval exe_name=mvindex(split(exe, "/"), -1)
| search NOT exe_name IN ("gdb", "strace", "ltrace", "valgrind", "perf", "dockerd", "containerd", "runc")
| eval ptrace_request=case(
    a0="0", "PTRACE_TRACEME",
    a0="1", "PTRACE_PEEKTEXT",
    a0="2", "PTRACE_PEEKDATA",
    a0="4", "PTRACE_POKETEXT",
    a0="5", "PTRACE_POKEDATA",
    a0="6", "PTRACE_CONT",
    a0="10" OR a0="16", "PTRACE_ATTACH",
    a0="11" OR a0="17", "PTRACE_DETACH",
    a0="d" OR a0="13", "PTRACE_SETREGS",
    a0="19" OR a0="25", "PTRACE_SEIZE",
    1=1, "PTRACE_OTHER_" . a0
)
| eval InjectionIndicator=if(match(ptrace_request, "(POKETEXT|POKEDATA|SETREGS|ATTACH|SEIZE)"), "High - Write/Modify capability", "Low - Read-only operation")
| table _time, host, auid, uid, exe, pid, ptrace_request, a1, InjectionIndicator
| sort - _time
high severity medium confidence

Detects ptrace system calls via Linux auditd logs. Decodes the ptrace request type from the first argument (a0) to identify injection-relevant operations: PTRACE_ATTACH (attaching to a process), PTRACE_POKETEXT/POKEDATA (writing memory), and PTRACE_SETREGS (modifying register values including instruction pointer). Filters out legitimate debuggers and container runtimes.

Data Sources

Process: OS API ExecutionLinux auditdsyscall=101 (ptrace on x86_64)

Required Sourcetypes

linux:audit

False Positives & Tuning

  • Developers using gdb/strace/ltrace for debugging
  • Container runtimes using ptrace for namespace operations
  • Performance profiling tools (perf, valgrind) using ptrace
  • Security scanning tools performing process analysis via ptrace
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