top of page
cosmodiumcs.png
Writer's pictureC0SM0

Off The Grid

// A Space Heroes CTF 2022 Challenge...


Hey Hackers! Space Heroes CTF 2022 has just recently ended. Here is the write up for the "Off The Grid Challenge". But if you would rather watch the solution, I will attach the video write up below.

 
 

// The Grid:

The challenge starts off by giving us the following message

A space pirate was able to infiltrate the Galactic Federation HQ and plant a virus that's locked everyone out! Whenever they boot their machines, all that they see is this strange grid. Whoever this space pirate is, he sure doesn't play fair.

The mentioning of "play fair" is an obvious reference to the play fair cipher [more on that later]. Attached to the message is the following image of a grid.


// The Play-fair Cipher:

The Play-fair is a cipher where we use a 5 x 5 grid of the alphabet [25 total letters] to encrypt and decrypt text. Since there are 26 letters in the English alphabet, it cannot [by default] fit into a 5 x 5 grid. So a specific letter is chosen to represent another letter. Typically, the letter "i" will represent "j" or "q" so it can be condensed down into 25 letters.

While doing research for the Play-fair cipher, I came across a Wikipedia page explaining how the cipher works. So I will summarize. Please note, the following images were sources form Wikipedia.org.

Let's say our key is "playfair example", so we need to translate it into a 5 x 5 grid. Remember that we cannot have any repeating letters, and once we finish our key we must complete the rest of the alphabet.

Now let's take the plaintext "hide the gold in the tree stump". In order to encrypt the text, we split it into two letter segments where "X" is used a filler to keep the pairs consistent [HI DE TH EG OL DI NT HE TR EE ST UM PX]. Now we find each pair on the 5 x 5 grid.

If they create a box, match the opposing letters together. So "HI" becomes "BM".

If they create a vertical segment, add each character below to encrypt and each character above to decrypt. So "DE" becomes "OD".

If they create a horizontal segment, add each character to the right to encrypt and each character to the left to decrypt. So "EX" becomes "XM".


// Analyzing Our Grid:

Now if we look back at the grid we were given, we will notice two things in particular about it. First, the there are random characters in the text that are capitalized. Second, there is the encrypted flag at the bottom. Knowing that we are working with the playfair cipher, we can decrypt the flag using the given grid. Resulting in "schtf{The_Prophecy_Has_Spoken}". Thanks for reading, and as always,


Happy Hacking!


// Socials:

© 2022 by Cosmodium CyberSecurity LLC

94 views0 comments

Recent Posts

See All

Comments


bottom of page