In process_hash
, the size of input is 1024
, the size after b64d
is 512, however, it should be 1024*3/4
, so there's a buffer overflow here.
Because of the stack canary, we can do nothing. I was confused here until I noticed the canary is also used in my_hash
to generate random number. Since the canary is gs:0x14
, it's always the same in all function calls.
We can calculate the canary value from the captcha
because the seed of randomization is the current time, we can fetch it from http request to http://pwnable.kr
.
After trying input b64e("AAAA"*(768/4))
to the program, jump to pass the canary check and break at ret
, we can notice that the top of stack is AAAA...
.