gdb - writeup
Morten Hansen • July 7, 2021
WRITE-UP
Challenge:
I think the flag might be decrypted and left in memory. Maybe a debugger will help?
Check out the CTF @ ForeverCTF
Steps to do:
Open file in Ghidra. Change name on the values. Find out what we know for certain.
Run
gdb -q ./gdb
in order to debug it.- Start debug-session with
start
and mark breakpoint withbreak *main
- Type
run
to run - We find out from Ghidra that the length have to be 36 bytes (not 37, because of \n appended)
- At what point are we certain that the flag excists in the memory? Hower over the function in Ghidra at that point and note the "Function offset" which in this case is
main +240h
. the240h
stands forhex 0x240
- open
gdb
again, start debug and set breakpoint atbreak *main + 0x240
- Run the file and type in a string with length of 36. Watch the outcome that is the flag
Finish
Thanks to langemyh