
- by x32x01 ||

Why Do Attackers Use It?




Common Linux Injection Techniques
ptrace Injection
The ptrace syscall (used by debuggers like gdb) lets one process control another.Attackers abuse it to modify memory/registers of target processes.
LD_PRELOAD Hijacking
Environment variable LD_PRELOAD forces the system to load a custom shared library before others.Malware injects malicious functions into legitimate programs.
/proc Memory Injection
By writing directly into /proc/<pid>/mem, attackers can overwrite process memory.Process Hollowing
Replace the memory of a legitimate process with malicious code while keeping the same PID/name.Signal & Code Injection
Using signals (SIGTRAP, SIGSEGV, etc.) combined with handlers to trigger malicious payloads.
Defense Against Process Injection
To reduce the risk, defenders can:
Enable SELinux/AppArmor → Restricts what processes can do.Use Seccomp → Limits syscalls like ptrace.
Monitor /proc Access → Watch for unusual writes to /proc/<pid>/mem.
Check Loaded Libraries → Spot malicious LD_PRELOAD usage.
Behavioral Detection → Look for suspicious process interactions.
Key Takeaway
Linux process injection is not theoretical - it’s actively used in modern malware campaigns. Attackers exploit trust in system processes to stay hidden. Defenders must monitor memory, syscalls, and libraries to detect these stealthy techniques.
If you’re learning offensive security → Try implementing safe demos of ptrace or LD_PRELOAD in a lab.
If you’re defending → Build detection rules around unexpected process manipulation.
