|
|
|
|
|
by geofft
2360 days ago
|
|
How do you detect that you're being ptraced? I see the link to https://www.aldeid.com/wiki/Ptrace-anti-debugging in the README, but a) the program has to actively run its check while being ptraced to notice. If you attach to the program (which pauses it), inject your code, run your code, and then detach, the program's own code will not notice it's being ptraced, no? b) if you want to run the program's own code while being ptraced, can't you just stop on the ptrace syscall and lie about its result? I think `strace -e inject=ptrace:errno=0` will avoid the program in that wiki page from realizing it's being traced. (You can use seccomp-bpf for this if you don't want to take the performance overhead of stopping on every syscall.) |
|
Depends on if all threads were put into a paused state. Also, the program that's being debugged might have spawned some additional processes that will be checking if the parent is being ptraced.
Replace "self" with the PID you want to check if it is being traced: