Back To The 90s
- Category: Reversing
- 400 points
- Solved by JCTF Team
For this challenge, we get the URL of a good old snake game. Really back to the 90's. First, let's play a little. The game consists of controlling a never-stopping snake to catch "fruits" (made of a few pixels each) without crashing in the walls or on itself. There are two types of fruits. The ^ and the x. After a few games, it was clear than even if their position was looking random, their order was not. It always started:
At the end of the wasm file was a huge array of 0's. Except 54 bytes, at the exact offset 1024.
Looking for an access to this offset within the disassembled code, we find one place, and incidentally, it is xor-ed just a few instructions after.
So we put a break-point on these lines, and let's see what we get.
We see the first byte of the array (49 = 0x31) xor-ed with some value 115, coming from offset 1132. And immediately after, the result of the xor is stored at offset 1132. At this stage, it's already clear that if go back this path, we'll xor the next byte with the result of the previous xor.
So we just wrote the following few lines and got the flag.