Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

05_ELF_hooking fails to work well #2

Closed
deathmemory opened this issue Jul 12, 2018 · 7 comments
Closed

05_ELF_hooking fails to work well #2

deathmemory opened this issue Jul 12, 2018 · 7 comments

Comments

@deathmemory
Copy link

$ cd 05_ELF_infect_plt-got/
$ make
gcc crackme.c -O3 -o crackme.bin
chmod u+rx crackme.bin
gcc -nostdlib -nodefaultlibs -fPIC -Wl,-shared hook.c -o hook
In file included from hook.c:1:0:
arch/x86_64/syscall.c:24:13: warning: conflicting types for built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]
 static long _exit(int errcode) {
             ^~~~~
$ python hook_pltgot.py 
$ ./crackme.hooked XXXXXXXXXXXXXXXXXXXXX
Wrong

my OS:

$ uname -a
Linux ubuntu 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

LIEF version: 0.9.0

I found the segment has to added to the crackme.hooked and the .got address has been changed exactly.
But when it runs, the correct value will be changed back.
it still calls memcmp from libc

Please help

@romainthomas
Copy link
Member

Does make run fail ?

@deathmemory
Copy link
Author

Yes , it says that

$ make run
python ./hook_pltgot.py
chmod u+x ./crackme.hooked
./crackme.hooked XXXXXXXXXXXXXXXXXXXXX
Wrong
make: *** [run] Error 1

@romainthomas
Copy link
Member

could you attach your compiled crackme.bin and crackme.hooked ?

@deathmemory
Copy link
Author

yes i can

@romainthomas
Copy link
Member

I mean upload it on this github issue

@deathmemory
Copy link
Author

OK ~

05_bin_hook.zip

@deathmemory
Copy link
Author

It works now , thank you ! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants