PicoCTF2022 - substitution0
Description
A message has come in but it seems to be all scrambled. Luckily it seems to have the key at the beginning. Can you crack this substitution cipher? Download the message here. Download the message here.
Information
Point Value: 100 points
Category: Cryptography
Hints
- Try a frequency attack. An online tool might help.
Solution
We know the text file is encoded using a substitution cipher, so we open the txt file to obtain the encoded cipher, and use CyberChef to decode it. We also know that the first line of the encoded cipher is the key, given as "OHNFUMWSVZLXEGCPTAJDYIRKQB", corresponding to the alphabet of "ABCDEFGHIJKLMNOPQRSTUVWXYZ", meaning that every letter 'O' we see is an 'A' in plaintext, 'H' is 'B', 'N' is 'C', etc. Entering the encoded cipher from the txt file as the input and using the "Substitute" recipe with a plaintext of "OHNFUMWSVZLXEGCPTAJDYIRKQB" and a ciphertext of "ABCDEFGHIJKLMNOPQRSTUVWXYZ", we get the decoded cipher, with the first paragraph being an excerpt from "The Gold Bug" written by Edgar Allan Poe, while we see the flag as well. We can also check our work as we see the last line in the encoded cipher appears to be in the format of our picoCTF flags ("picoCTF{...}"). The first three words are probably "The flag is: ", which means we can match the letters and see that they confirm the substitution key we were given.