gdb

Debug a binary with gdb

gdb <file name>

(gdb) r <argument (payload)>

  • r is for 'run'

Program received signal SIGSEGV, Segmentation fault.

0x316d4130 in ?? ()

(gdb)

use the pattern offset script to find where 0x316d4130 is located

msf-pattern_offset -q 0x316d4130

[*] Exact match at offset 362

Using with a python generated payload

(gdb) r $(python -c 'print "A"*400')

find esp register

(gdb) x/100x $esp

  • x for examine

    • here we are examining 100 bytes at a time

setup the peda extension

git clone https://github.com/longld/peda.git ~/peda

echo "source ~/peda/peda.py" >> ~/.gdbinit

echo "DONE! debug your program with gdb and enjoy"

Last updated