CSAW CTF Qualification Round 2016 – Reversing Gametime 50 pts Write-up

This was a Windows challenge. You were provided with a 32 bit binary named “gametime.exe” and the following sentence:

Guess what time it is! That’s right! Gametime! Wowwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww!!!!!!!!!!!!

Author: Brad Antoniewicz

note: flag is not in flag{} format

When you execute the program, you first get a little tutorial and then the actual game starts. Basically, you have to press the space bar when you see a “s”, press the x key when you see “x” and press the m key when you see a “m” on the screen. If you fail, you get the following error message:

UDDER FAILURE! http://imgur.com/4Ajx21P

Sounds easy uh?. The first round is kind of easy but then you get “Turbo Mode” and you need to be very quickly when pressing the keys if you don’t want to get the error message. As I was never good  for this kind of games so I decided to use a debugger 😉

In order to solve the game, you don’t need to do a great effort. I started by looking at the string references and got the function in charge of showing the error message:

failure

I called this function “FAILURE“. I put a breakpoint at the top of the function and another one in the JNZ where the decision of “right/wrong” is done. The call before this jump is the one in charge of checking if you pressed the right key.

The main function starts, in this case, at 0x33157B and is quite lineal:

main

What I did next was to start the game and played. Then, the only thing I did was to revert the value of the Z flag when I wasn’t to quick to press the right quick. There aren’t many calls to the “FAILURE” functions:

failure_xrefs

At the end of the game, I got the flag:

gametime_key

Leave a comment