Space Heroes CTF : Off The Grid - not1cyyy/CTF-Writeups GitHub Wiki

Description

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.

Files

  • CryptoGrid.png

CryptoGrid

  • enc.txt
UIKOTHNVGELBKCRNPDDN

Solution

Recon

  • I didn't notice it right away but after I looked at the challenge description I noticed this : "...he sure doesn't play fair", that's a clear sign to the play fair cipher

Explanation

The play fair cipher is a cipher that relies on a grid to encrypt the message needed

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".

Execution

Perfect ! now we know exactly what to do, given an encrypted flag at the bottom of the grid and in the text file we follow exactly what was explained above and voila!

Flag

shctf{the_PRophecY_has_spoken}