-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
ValueError while launch process with gdb.debug() #1907
Comments
This is a dupe of #1898 which was just fixed in v4.5.1. Update your pwntools and it should work!
|
Hi heapcrash, I'm sorry, but I still have the same issue after update pwntools to 4.5.1, here's my code, I'm new to pwntools: from pwn import *
context(terminal=['tmux','new-window'])
p = gdb.debug('./adminhelper', 'b main')
context(os='linux', arch='amd64')
junk = "A" * 72
pop_rdi = p64(0x8c3)
got_puts = p64(0x201020)
plt_puts = p64(0x650)
gadget_leak = pop_rdi + got_puts + plt_puts
p.sendline(junk + gadget_leak)
p.interactive() Then I got the error after I execute it: └─$ python3 exploit.py
[+] Starting local process '/usr/bin/gdbserver': pid 37036
[*] running in new terminal: /usr/bin/gdb -q "./adminhelper" -x /tmp/pwn2jro4gpt.gdb
Traceback (most recent call last):
File "/dev/shm/exploit.py", line 3, in <module>
p = gdb.debug('./adminhelper', 'b main')
File "/home/htb/.local/lib/python3.9/site-packages/pwnlib/context/__init__.py", line 1543, in setter
return function(*a, **kw)
File "/home/htb/.local/lib/python3.9/site-packages/pwnlib/gdb.py", line 577, in debug
tmp = attach((host, port), exe=exe, gdbscript=gdbscript, ssh=ssh, sysroot=sysroot, api=api)
File "/home/htb/.local/lib/python3.9/site-packages/pwnlib/context/__init__.py", line 1543, in setter
return function(*a, **kw)
File "/home/htb/.local/lib/python3.9/site-packages/pwnlib/gdb.py", line 1051, in attach
gdb_pid = misc.run_in_new_terminal(cmd, preexec_fn = preexec_fn)
File "/home/htb/.local/lib/python3.9/site-packages/pwnlib/util/misc.py", line 303, in run_in_new_terminal
pid = int(out)
ValueError: invalid literal for int() with base 10: b''
[*] Stopped process './adminhelper' (pid 37040) I had double confirmed that the new change is applied into misc.py for the tmux switch of -F or -P. Thank you very much. |
I believe we should catch the ValueError anyway, and provide more details in case of failure, |
Hi Arusekk, Thanks for the advice, this error of mine, was issued after launching a new terminal of tmux. Should tmux version be consider as part of the reason? └─$ tmux -V
tmux 3.1c
└─$ python3 exploit.py DEBUG
[+] Starting local process '/usr/bin/gdbserver' argv=[b'/usr/bin/gdbserver', b'--multi', b'--no-disable-randomization', b'localhost:0', b'./adminhelper'] : pid 40642
[DEBUG] Received 0x43 bytes:
b'Process ./adminhelper created; pid = 40646\n'
b'Listening on port 33569\n'
[DEBUG] Wrote gdb script to '/tmp/pwn9chlrr06.gdb'
target remote 127.0.0.1:33569
b main
[*] running in new terminal: /usr/bin/gdb -q "./adminhelper" -x /tmp/pwn9chlrr06.gdb
[DEBUG] Launching a new terminal: ['/usr/bin/tmux', 'new-window', '-F#{pane_pid}', '-P', '/usr/bin/gdb -q "./adminhelper" -x /tmp/pwn9chlrr06.gdb']
Traceback (most recent call last):
File "/dev/shm/exploit.py", line 3, in <module>
p = gdb.debug('./adminhelper', 'b main')
File "/home/htb/.local/lib/python3.9/site-packages/pwnlib/context/__init__.py", line 1543, in setter
return function(*a, **kw)
File "/home/htb/.local/lib/python3.9/site-packages/pwnlib/gdb.py", line 577, in debug
tmp = attach((host, port), exe=exe, gdbscript=gdbscript, ssh=ssh, sysroot=sysroot, api=api)
File "/home/htb/.local/lib/python3.9/site-packages/pwnlib/context/__init__.py", line 1543, in setter
return function(*a, **kw)
File "/home/htb/.local/lib/python3.9/site-packages/pwnlib/gdb.py", line 1051, in attach
gdb_pid = misc.run_in_new_terminal(cmd, preexec_fn = preexec_fn)
File "/home/htb/.local/lib/python3.9/site-packages/pwnlib/util/misc.py", line 303, in run_in_new_terminal
pid = int(out)
ValueError: invalid literal for int() with base 10: b''
[*] Stopped process './adminhelper' (pid 40646) Any further suggestion please? Thank you very much. |
So try to launch Try using splitw instead of new-window for now, and use BTW try to format your pasted terminal output as code, either by doing this
or this:
or by reading more about GitHub markdown. |
I don’t think pane-pid will work with new-window, maybe?
|
Just investigated, seems like it should work...
Update: Works for me. Maybe update tmux?
|
For anyone else experiencing the same issue, just open |
You're right. |
Error message fixed by #2314 |
Hi there,
I always got
ValueError: invalid literal for int() with base 10: b''
when I try to launch gdb.debug(). Is it problem with pwntools or tmux? How should I workaround it?I have the latest version of pwntools/gdbserver.
And when I try to do
io = gdb.debug("/bin/bash", gdbscript='continue')
I will get below error:Or
If I do
io = process('/bin/sh'); gdb.attach(io, gdbscript='continue')
, I will have below:So far no other error when I try to do remote, etc. by pwntools. I'm very appreciate if anyone can help me to find the problem.
Thanks in advance.
The text was updated successfully, but these errors were encountered: