MayADevBe Blog

A Blog about Computer Science

Krypton Level 4 -> 5 - OverTheWire Walkthrough

Previous Level: Level 3


SSH: ssh -p 2231


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.


My Ideas:

  1. 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.
  2. 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.
  3. 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:

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:

  1. In the field VIGENERE CIPHERTEXT put in the content of the found1 file.
  2. For Decryption method choose “KNOWING THE KEY-LENGTH/SIZE, NUMBER OF LETTERS:” and set it to 6.
  3. Click the decrypt button. And look at the results. The key is: XXXXXX
  4. In the field VIGENERE CIPHERTEXT put in the content of the krypton5 file.
  5. For Decryption method choose “KNOWING THE KEY/PASSWORD:” and set it to the key.
  6. Click the decrypt button. And look at the results.

Share on: