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

gdb.debug not so obvious error msg #1069

Closed
disconnect3d opened this issue Nov 25, 2017 · 2 comments
Closed

gdb.debug not so obvious error msg #1069

disconnect3d opened this issue Nov 25, 2017 · 2 comments

Comments

@disconnect3d
Copy link
Contributor

When the gdb.debug fails to launch binary under gdbserver it shows a not-super-obvious error. This might happen for example when one sets LD_PRELOAD to load different libc library.

Example

NOTE: I had to run sudo apt-get update && sudo apt-get install gdbserver first.
NOTE2: I have used /bin/bash as LD_PRELOAD but that could be a .so library not compatible with the binary (e.g. wrong arch).

pwntools@a0b508e4b82d:~$ python -c 'from pwn import *; gdb.debug("/bin/ls", env={"LD_PRELOAD": "/bin/bash"})'
[+] Starting local process '/usr/bin/gdbserver': pid 254
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/pwnlib/context/__init__.py", line 1349, in setter
    return function(*a, **kw)
  File "/usr/local/lib/python2.7/dist-packages/pwnlib/gdb.py", line 396, in debug
    port = _gdbserver_port(gdbserver, ssh)
  File "/usr/local/lib/python2.7/dist-packages/pwnlib/gdb.py", line 233, in _gdbserver_port
    gdbserver.pid   = int(process_created.split()[-1], 0)
ValueError: invalid literal for int() with base 0: 'ignored.'
[*] Stopped process '/bin/ls' (pid 254)
pwntools@a0b508e4b82d:~$ 
@disconnect3d disconnect3d changed the title Better errors for gdb.debug gdb.debug not so obvious error msg Nov 25, 2017
@zachriggle
Copy link
Member

I'm not sure of any way we can really detect this in the generic case.

I'd be interested in a pull request if you have time <3

@zachriggle
Copy link
Member

Closed with #1083

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

No branches or pull requests

2 participants