This is a write-up of the readme challenge from the 32c3 CTF
The Challenge
This was a pwnable binary with with the flag baked into it, which you could see if you ran:
The flag is located at 0x600d20 in the .data section.
The challenge was very simple, it was a service witch gets your name onto the stack,
and then it asks you to over write the flag at 0x600d20
The Solution
First of all the flag is mapped into memory twice, because of how elf works it is also located in read-only memory at 0x400d20 but only the flag in the .data section gets overwritten.
So locally we could get it printed simply by smashing our stack all the way upto argv,
and then let _stack_chk_fail print it for us.
which prints when executed:
however this does not work remotely, this is becuase _stack_chk_fail calls __fortify_fail which calls __lib_message which does this:
which means that we only need to set LIBC_FATAL_STDERR_ and the flag will get printed over stderr instead of /dev/tty.