Skip to content

Instantly share code, notes, and snippets.

@Inndy
Last active October 18, 2017 13:28
Show Gist options
  • Save Inndy/fb0830caca0f8557225d3e152d1f0445 to your computer and use it in GitHub Desktop.
Save Inndy/fb0830caca0f8557225d3e152d1f0445 to your computer and use it in GitHub Desktop.
Use gdb script to solve OpenCTF 2016 neophyte_revsersing (linked from ctftime writeup)
b *0x080492a4
commands 1
set $last_data = $eax
call memcpy($tmp, $last_data, 0x14)
continue
end
b *0x080492ad
commands 2
call memcpy($last_data, $tmp, 0x14)
set $argv = *(char***)($ebp+0xc)
set $flag = $argv[1]
set $i = *(int*)($esp+0x18)
set $flag[$i] += 1
x/s $flag
set $eip = 0x0804927e
continue
end
b *0x080492B5
commands 3
x/s $flag
continue
end
b *0x08049242
commands 4
call malloc(0x14)
set $tmp = $eax
continue
end
run " "
# vim: ft=gdb

Actually I solved this challenage with angr, but I tried to do this with gdb scripting after DEF CON.

Have fun :)

gdb ./neophyte_revsersing
source ./neophyte_revsersing.gdbscript
# wait for flag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment