🟦Bi0sCTF 2024

Writeup for A Block and a Hard Place

Only one challenge writeup this time, really tough multi-part questions and only had time to solve this one all the way through.

A Block and a Hard Place (28 Solves)

Description:

Are you the Far Lands because you're a Maze? Or are you a Maze because you're the Far Lands?

Solution:

We're given only a server to netcat to and nothing else. Once connected, we can move with either wasd or WASD to jump over walls.

─$ nc 13.201.224.182 30961                                                                                    130 β¨―
Welcome to The Far Lands! You're free to explore. 
You can move around using wasd (lowercase). 
If you hit a wall, you can jump over them using WASD (uppercase). 
You can't jump if there's no wall in front of you. 
Lastly, you're placed in a random position in the maze. 
Do your best to figure out it's secrets!

2000> w
Moved!
1999> w
You can't move there!
1998> W
Jumped over a wall!
1997> w
Moved!
...

Once we get to the boundary (at the top when trying w/W), neither option will work. To map out the entire maze, I wrote the following to go to the upper left corner, and then zig-zag right and left through the maze.

This will print out the rows, with a # for if there was a wall. Since we're going backwards every other row, I have * in the output to make a note to flip it. I did that by copy pasting the output to a text file, and in vim selecting the row (V) and then reversing it (:%!rev). Then find/replace * with # and deleting all characters other than # and space. See the final output below.

This looks like a QR code but not quite, and this is because this is just a representation of where the horizontal walls are. Picturing a black and white QR code, each horizontal wall should signify a switch from white to black, and vice versa. Therefore, every time a # is encountered, it's actually a toggle. The below code fixes this.

This gives us the fixed map, but it's in ASCII so one more program to convert it to a QR image.

Using a QR reader, we get the flag!

Last updated

Was this helpful?