medbof

this is a classic ret2win challenge
File Reconnaissance :
this is a 64bit binary, not stripped which means that the names of the functions is not obfuscated which makes reversing process easier.
the only protection enabled is NX which makes executing shellcode impossible.

let's open the binary using ghidra
we have 3 functions

main :

do_input :

and the last function is the win function we wanna jmp to
do_system :

gets is a vulnerable to buffer overflow so we are going to overflow the buffer and overwrite the RIP with the address of the win function (do_system)
Calculating the offset to overwrite the RIP :
like the previous challenge (crashme) using gdb-pwndbg and cyclic we will find that the offset is 40
Exploit :
now let's run the exploit remotely

Flag :
Last updated
Was this helpful?