KryptonOverTheWire

Krypton2

Website: http://overthewire.org/wargames/krypton/krypton1.html

According to the website page:

The password for level 2 is in the file ‘krypton2’. It is ‘encrypted’ using a simple rotation. It is also in non-standard ciphertext format. When using alpha characters for ciphertext it is normal to group the letters into 5 letter clusters, regardless of word boundaries. This helps obfuscate any patterns. This file has kept the plain text word boundaries and carried them to the ciphertext. Enjoy!

Let’s log in using krypton1 credentials

Fig. 1

Let’s navigate to the directory /krypton/krypton1

Fig. 2

Let’s see the contents of the README

Fig. 3

Let’s see the contents of the file krypton2

Fig. 4

Okay, so we know that rotation encryption (ROT13) has been used for this ciphertext, also preserving the word boundaries.

In case of ROT13, every letter is shifted by 13 in the alphabet, in a cyclic manner. So, let’s whip ourselves up a small program which will do the decryption for us.

import re

charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def shift(c,n, forward=True):
    if c in charset:
        index = charset.index(c)
        if forward == True:
            shifted_index = (index + n)%len(charset)
        else:
            shifted_index = (index - n)%len(charset)
        return charset[shifted_index] 
    else:
        print "Invalid character"
        return -1

def main():
    ciphertext = "YRIRY GJB CNFFJBEQ EBGGRA"
    cipher_list = ciphertext.split(' ')
    plaintext = ''
    for item in cipher_list:
        for c in item:
            plaintext += shift(c,13,False)
        plaintext += ' '
    print plaintext
    return
    
if __name__=='__main__':
    main()

Let’s run the program.

Fig. 5

So, we have our credentials!

Username: krypton2

Password: *******

Leave a Reply

Your email address will not be published. Required fields are marked *