- Learning Linux Binary Analysis
- Ryan “elfmaster” O'Neill
- 208字
- 2021-07-16 12:56:55
ptrace requests
The ptrace
system call has a libc
wrapper like any other system call, so you may include ptrace.h
and simply call ptrace
while passing it a request and a process ID. The following details are not a replacement for the main pages of ptrace(2)
, although some descriptions were borrowed from the main pages.
Here's the synopsis:
#include <sys/ptrace.h> long ptrace(enum __ptrace_request request, pid_t pid, void *addr, void *data);
ptrace request types
Here is a list of requests that are most commonly used when using ptrace
to interact with a process image:
The term tracer refers to the process that is doing the tracing (the one that is invoking ptrace
), and the term tracee or the traced means the program that is being traced by the tracer (with ptrace
).
Note
The default behavior overrides any mmap or mprotect permissions. This means that a user can write to the text segment with ptrace
(even though it is read-only). This is not true if the kernel is pax or grsec and patched with mprotect restrictions, which enforce segment permissions so that they apply to ptrace
as well; this is a security feature.
My paper on ELF runtime infection at http://vxheavens.com/lib/vrn00.html discusses some methods to bypass these restrictions for code injection.
- Advanced Machine Learning with Python
- Boost程序庫完全開發指南:深入C++”準”標準庫(第5版)
- Visual C++程序設計教程
- 摩登創客:與智能手機和平板電腦共舞
- Offer來了:Java面試核心知識點精講(原理篇)
- DevOps入門與實踐
- 程序員考試案例梳理、真題透解與強化訓練
- 從0到1:HTML+CSS快速上手
- Java深入解析:透析Java本質的36個話題
- Python數據可視化之Matplotlib與Pyecharts實戰
- 移動互聯網軟件開發實驗指導
- 案例式C語言程序設計實驗指導
- 鴻蒙OS應用編程實戰
- Visual Basic程序設計(第三版)
- RESTful Web API Design with Node.js(Second Edition)