Bypassing simple anti-debug feature of a CTF with LD_PRELOAD flag
2025-1-24 20:11:34 Author: www.reddit.com(查看原文) 阅读量:2 收藏

Hello everybody, it's been a while i'm learning reverse engineering. Today i've stumbled upon a CTF that uses a simple anti-dbg measure, using just ptrace and PTRACE_TRACEME flag. By gathering some infos I saw that there is a simple hook I can use, suing the LD_PRELOAD flag. I did some tests on some programs that i wrote and seems effective. The problem about the CTF is that uses a dlopen of a specific lib in the system, it seems to be more relevant than the custom lib that I load with that flag obviously. Maybe I can solve the problem with patching but first I want to try solving the thing this way. Clearly there is something that I am missing here. I post here also the code if it might help.

ptrace_sym = 0x61727470;

local_1b = 0x6563;

local_19 = 0;

libhandle = dlopen("libc.so.6",1);

if (libhandle == 0) {

/* WARNING: Subroutine does not return */

exit(1);

}

sym = (code *)dlsym(libhandle,&ptrace_sym);

if (sym == (code *)0x0) {

/* WARNING: Subroutine does not return */

exit(1);

}

(*sym)(0,0);


文章来源: https://www.reddit.com/r/HowToHack/comments/1i94qfm/bypassing_simple_antidebug_feature_of_a_ctf_with/
如有侵权请联系:admin#unsafe.sh