description | cover | coverY |
---|---|---|
11/02/2023 |
-77.72575250836121 |
Segfaults or other unexpected failed exploits?
Note: Your exploits are going to fail more than 90% of the time the first time you run them.
There are a few ways we can do this:
- ulimit -c unlimited
- Upon a segfault, a message will appear,
(core dumped)
- Throw your core dump into
gdb
:gdb -c /var/lib/coredumps/dump_here
On Ubuntu, you will have to do things a little differently:
ulimit -c unlimited
sudo service apport start
cd /var/lib/apport/coredump
gdb -c core...
Debugging an exploit in gdb
Be sure when you are dealing with issues within your exploit script, that you are placing the following before the sending of your payload and before your interactive session:
gdb.attach(p)
pause()
For example:
gdb.attach(p)
pause()
p.sendline(payload)
p.interactive()
This will start up GDB server in a different window and allow you to interact with your binary within pwndbg
.
Be sure to utilize c
to continue through execution and si
to step into functions as well as n
to jump to the next instruction.