gaffe23 / linux-inject

Tool for injecting a shared object into a Linux process
Other
1.1k stars 246 forks source link

__libc_dlopen_mode gone in glibc-2.33.9000+ #19

Open danielfvm opened 2 years ago

danielfvm commented 2 years ago

I am currently using libc version 2.35, and it looks like __libc_dlopen_mode was removed from the library. I found verification for its removal here, I also can't find it with readelf --dyn-syms. When running the program I get following error:

targeting process "test" with pid 6824
instead of expected SIGTRAP, target stopped with signal 11: Segmentation fault
sending process 6824 a SIGSTOP signal for debugging purposes

Because __libc_dlopen_mode was removed, the following code returns 0 leading to the crash.

long dlopenAddr = getFunctionAddress("__libc_dlopen_mode");

This is probably the same problem as seen in #18 and #16. I'm not sure how to solve this issue, maybe there is an alternative to __libc_dlopen_mode?

papstuc commented 2 years ago

nm -D libc.so.6 | grep dlopen

I built the newest version, which was 2.36 and found 2 exports which should work

0000000000082f10 T dlopen@GLIBC_2.2.5
0000000000082f10 T dlopen@@GLIBC_2.34

try to just use "dlopen"

danielfvm commented 2 years ago

Yes I tired that already, I wasn't able to get it working with this project (still some crash some where else), but I got it working with my own python implementation that basically does the same thing.