-
Notifications
You must be signed in to change notification settings - Fork 857
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
After patchelf is used to modify the elf file, the heap and bin commands cannot be used #924
Comments
Can you upload a zipped copy of your before / after binary so that we can take a look? This (using patchelf) isn't something I've seen before, and it's possible it's leaving remnants behind of the old interpreter. |
Above is the binary file before and after patchelf |
What are your thoughts on these kind of "Quick Fixes" ? |
Is this still the case? I think this should work now, after we have an option of resolving heap symbols via heuristic. |
I think this should be fixed, and if not I recommend using |
I'm going to close this, if anyone believes this is still an issue please let me know. |
This is still an issue. Run |
cc: @lebr0nli :) |
I'm not sure the reason why
Regarding the original issue about our $ cat a.c
#include <stdlib.h>
int main(){
free(malloc(0x10));
}
$ gcc a.c
$ pwninit
bin: ./a.out
libc: ./libc.so.6
ld: ./ld-linux.so
copying ./a.out to ./a.out_patched
running patchelf on ./a.out_patched
$ ldd a.out_patched
linux-vdso.so.1 (0x00007ffe52fc7000)
libc.so.6 => ./libc.so.6 (0x00007f8aff2eb000)
./ld-linux.so => /lib64/ld-linux-x86-64.so.2 (0x00007f8aff51c000)
$ gdb -q a.out_patched -ex 'set debug-file-directory' -ex 'start' -ex 'next' -ex 'next' -ex 'next' -ex 'next' -ex 'heap' -ex 'bins'
...
Allocated chunk | PREV_INUSE
Addr: 0x55855568d000
Size: 0x290 (with flag bits: 0x291)
Free chunk (tcachebins) | PREV_INUSE
Addr: 0x55855568d290
Size: 0x20 (with flag bits: 0x21)
fd: 0x55855568d
Top chunk | PREV_INUSE
Addr: 0x55855568d2b0
Size: 0x20d50 (with flag bits: 0x20d51)
tcachebins
0x20 [ 1]: 0x55855568d2a0 ◂— 0x0
fastbins
empty
unsortedbin
empty
smallbins
empty
largebins
empty
... |
Oh I see, my bad. I will pull an issue on GDB and if it doesn't work out I will pull a feature request here for improved symbol parsing, okay? |
Which version of pwninit are you using, this is supposed to be fixed in 3.1.1 with a workaround io12/pwninit@ca34d07
The real issue seems to be in patchelf where it produces a broken result if multiple options are used at the same call.
|
|
Sorry I had a typo. I fixed it in 3.3.1 so please upgrade your pwninit and try again 😊
|
Seems to work now! Thanks.
|
Is this issue still valid or was it fixed? cc: @k4lizen @lebr0nli @D1ag0n-Young pls, re-check. |
Re-checked, works. The issue wasn't with pwndbg but with patchelf anyways, so should be good to close. |
I did the following:
patchelf --set-interpreter $libc_dir/ld-$LIBC_VERSION.so --set-rpath $libc_dir/ tsh
View binary file:
ldd tsh
gdb tsh
Prompt the debug information does not match,Then run the bin command:
This seems to be unable to find the symbol table for debugging,I try to do this:
Did not solve the problem
Note: I use patchelf to modify the binary file, and use the libc provided by glibc-all-in-one, which contains the .debug folder
Which step did I do wrong? Or pwngdb can only use the debug symbol table of system libc?
The text was updated successfully, but these errors were encountered: