Implementing and Detecting Anti-Debugging with Fork()
tonygo.netlify.app
tonygo.netlify.app
A far more effective actual anti-debugging technique is to have the parent become the debugger of the child, preventing any other debugger from attaching to it.
Do you have example of that? I am really curious, thanks for sharing tho :)
long ptrace(enum __ptrace_request op, pid_t pid, void addr, void data);
. to debug oneself you can try https://gist.github.com/x64-elf-sh42/83393e319ad8280b8704fbe...
it prints -1 due to some fail, but it cannot attach GDB to it :P
edit 9001: it notes the bash is attached to it which spawned the exe, not sure if that's correct or just buggy btw
I think that I should dig more on ptrace! Maybe a next post?
I am not really experienced with ARM haha :) So the way that I approached it was: - how could I remove the call of fork (because I don't want to fork) - how could I patch the register that should contains the result of the fork operation
I guess that it sounds like a naive approach haha
Feel free to propose an alternative I patch, I could update the post and credit you :)
I also tried with a long living process: https://github.com/tony-go/antidebug-examples/tree/main/swif...
And I got this:
``` (lldb) run Process 14345 launched: '/anti-debug/swift/build/anti_debug' (arm64) start pid = 14345 exit parent process for child pid = 14348 continue as child process pid = 14348 Process 14345 exited with status = 0 (0x00000000) ```
The UI did not even appeared as it should.
Maybe I miss something in my LLDB config...
You may still think that mode could be still able to catch a new child process but apparently people have tried and the answer is no
Not sure I got this. IIUC there is a link between the fact that we used dlsym and the fact the child process is not catched by lldb in the follow fork mode?
https://github.com/tony-go/antidebug-examples/pull/1
At first, it appears that the follow fork mode works nicely. But at some point it did not ... If I run it 10 times consequtively in LLDB. Sometimes it works, sometimes not ...