Previous Level: Level 3
Login
SSH: ssh krypton4@krypton.labs.overthewire.org -p 2231
Task
This level is a Vigenère Cipher. You have intercepted two longer, english language messages. You also have a key piece of information. You know the key length!
For this exercise, the key length is 6. The password to level five is in the usual place, encrypted with the 6 letter key.
A little bit of Theory
The task explanation gives a short explanation of what a Vigenère Cipher is. The Caesar cipher is a simplification of the Vigenère Cipher. Instead of one number that is used to encrypt the whole text, the Vigenère Cipher uses a secret key. This key is used to encrypt blocks of the length of the key. It is generally a word, however, for encryption the letters will be exchanged with their position in the alphabet. Therefore if the key would be length one, it would be the Caesar cipher.
Solution
My Ideas:
- We know the length of the key therefore we know the block length and which letters will be encrypted by the same shift. We can use this knowledge to do a frequency analysis for each letter of the key instead of the whole text.
- We could try brute force. This would be a lot of options though (6^26). Another problem is that we would need a way to see which result is the correct one, so a way to check if the output is a sentence in English (assuming the output makes sense) since we wouldn’t want to read all possible options.
- We use an existing Vigenère Cipher breaker on the internet.
After some more research, I found this Stack-Overflow thread that has a very nice explanation of how to solve this problem: https://stackoverflow.com/questions/59094006/breaking-vigenere-only-knowing-key-length.
Since I found no easy way for the first option that could be done on the command line and I did not feel like programming, I used the third option.
A simple Google search leads to different online options to break the cipher. I used: https://www.dcode.fr/vigenere-cipher
- In the field VIGENERE CIPHERTEXT put in the content of the
found1
file. - For Decryption method choose “KNOWING THE KEY-LENGTH/SIZE, NUMBER OF LETTERS:” and set it to 6.
- Click the decrypt button. And look at the results.
The key is:
XXXXXX
- In the field VIGENERE CIPHERTEXT put in the content of the
krypton5
file. - For Decryption method choose “KNOWING THE KEY/PASSWORD:” and set it to the key.
- Click the decrypt button. And look at the results.
https://overthewire.org/wargames/krypton/krypton4.html
Next Level: Level 5