pwndbg: After patchelf is used to modify the elf file, the heap and bin commands cannot be used
I did the following:
patchelf --set-interpreter $libc_dir/ld-$LIBC_VERSION.so --set-rpath $libc_dir/ tsh
View binary file: ldd tsh
linux-vdso.so.1 (0x00007fff4fcfc000)
libc.so.6 => /glibc/2.31/64/lib/libc.so.6 (0x00007f7f994f2000)
/glibc/2.31/64/lib/ld-2.31.so => /lib64/ld-linux-x86-64.so.2 (0x00007f7f996ec000)
- run command
gdb tsh
pwndbg> r
Starting program: /home/yrl/Desktop/gdbtest/tsh
warning: the debug information found in "/glibc/2.31/64/lib/.debug/ld-2.31.so" does not match "/glibc/2.31/64/lib/ld-2.31.so" (CRC mismatch).
ERROR: Could not find ELF base!
warning: the debug information found in "/glibc/2.31/64/lib/.debug/libc-2.31.so" does not match "/glibc/2.31/64/lib/libc.so.6" (CRC mismatch).
warning: the debug information found in "/glibc/2.31/64/lib/.debug/libc-2.31.so" does not match "/glibc/2.31/64/lib/libc.so.6" (CRC mismatch).
Prompt the debug information does not match,Then run the bin command:
pwndbg> bin
bins: This command only works with libc debug symbols.
They can probably be installed via the package manager of your choice.
See also: https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html
E.g. on Ubuntu/Debian you might need to do the following steps (for 64-bit and 32-bit binaries):
sudo apt-get install libc6-dbg
sudo dpkg --add-architecture i386
sudo apt-get install libc-dbg:i386
This seems to be unable to find the symbol table for debugging,I try to do this:
pwndbg> set debug-file-directory /glibc/2.31/64/lib/
pwndbg> r
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?
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 2
- Comments: 15 (8 by maintainers)
Sorry I had a typo. I fixed it in 3.3.1 so please upgrade your pwninit and try again 😊
I’m not sure the reason why
info func main
can’t findmain
afterpatchelf
, but at least this is not the pwndbg’s issue I guess. This can be reproduced with:Regarding the original issue about our
heap
andbins
commands, it seems to work fine with the libc and ld you provided afterpatchelf
. This can be verified with: