You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the gdb.debug() feature of pwntools an extra line is appended to the the passed gdbscript which in some cases can prevent proper symbol resolution.
root@kali:~/Downloads/crackmes# ptpython
>>> from pwn import *
>>> context.log_level = "DEBUG"
>>> p = gdb.debug('./crackme01.64')
...
[DEBUG] Wrote gdb script to '/tmp/pwnxnkmbope.gdb'
file "./crackme01.64"
target remote 127.0.0.1:38677
file "./crackme01.64"
and on gdb..
Reading symbols from ./crackme01.64...(no debugging symbols found)...done.
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Reading /lib64/ld-2.27.so from remote target...
Reading /lib64/.debug/ld-2.27.so from remote target...
0x00007f16e2289090 in ?? () from target:/lib64/ld-linux-x86-64.so.2
(gdb) disass main
Dump of assembler code for function main:
0x00000000000006aa <+0>: Cannot access memory at address 0x6aa
The issue stems from the fact that in the new version of gdb, when you run file after attaching to a remote target, it replaces the symbols in the current context. I downloaded and edited a local version of pwntools to remove that final line of the gdbscript and it seems to work fine.
...
[DEBUG] Wrote gdb script to '/tmp/pwnva62cw6s.gdb'
file "./crackme01.64"
target remote 127.0.0.1:34373
on GDB
(gdb) disass main
Dump of assembler code for function main:
0x0000557f59b586aa <+0>: push %rbx
0x0000557f59b586ab <+1>: cmp $0x2,%edi
0x0000557f59b586ae <+4>: jne 0x557f59b586ec <main+66>
This issue does not appear to happen on the pwntools container from Dockerhub. I believe that may be due to it using an older version of GDB (7.x), but I have not performed enough testing to determine that. In my own pwntools module I hacked together a solution, I am not familiar enough with the codebase to submit a pull request.
The text was updated successfully, but these errors were encountered:
Updated initial submission with more diagnostic information.
numin0us
changed the title
GDB does not resolve symbols properly
gdb.debug() appends an extra line to the passed gdbscript, resulting in symbol resolution errors
Aug 16, 2019
Pwntools Issue Template
When using the gdb.debug() feature of pwntools an extra line is appended to the the passed gdbscript which in some cases can prevent proper symbol resolution.
and on gdb..
The issue stems from the fact that in the new version of gdb, when you run file after attaching to a remote target, it replaces the symbols in the current context. I downloaded and edited a local version of pwntools to remove that final line of the gdbscript and it seems to work fine.
on GDB
This issue does not appear to happen on the pwntools container from Dockerhub. I believe that may be due to it using an older version of GDB (7.x), but I have not performed enough testing to determine that. In my own pwntools module I hacked together a solution, I am not familiar enough with the codebase to submit a pull request.
The text was updated successfully, but these errors were encountered: