MayADevBe Blog

A Blog about Computer Science

Krypton Level 1 -> 2 - OverTheWire Walkthrough

Previous Level: Introduction

Login

SSH: ssh krypton1@krypton.labs.overthewire.org -p 2231

Task

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 cipher text 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 cipher text. Enjoy!

A little bit of Theory

ROT13 is an easy substitution cryptosystem based on the Caesar cipher but with 13 as the key. This key has the advantage that the encryption function is the same as the decryption function for the Latin alphabet with 26 letters. This also exists for the 10 digits and is called ROT5.

The Caesar cipher is a shift cipher, meaning the letters are shifted by a certain number (the key). For example, with k=1, you encrypt A as B, B as C and so on until Z will be encrypted as A.

The bash command alias allows you to create shorter names for common commands. The structure is: alias <alias_name>="<lang_common_command>"

tr is the translate command. It allows you to replace or delete characters. It is used in UNIX pipes (find out more see [Bandit Level 6]https://mayadevbe.me/posts/overthewire/bandit/level6/). The structure for replacing characters is the following: tr '<initial_chars>' 'replacement_chars'. For example echo 'A' | tr 'A' 'a' would return a.

Solution

Based on the description in the previous level, it is said that the files for the levels are in the ‘/krypton/’ folder.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
krypton1@krypton:~$ cd /krypton/
krypton1@krypton:/krypton$ ls -la
total 32
drwxr-xr-x  8 root root 4096 May 19  2020 .
drwxr-xr-x 27 root root 4096 May 19  2020 ..
drwxr-xr-x  2 root root 4096 May 19  2020 krypton1
drwxr-xr-x  2 root root 4096 May 19  2020 krypton2
drwxr-xr-x  2 root root 4096 May 19  2020 krypton3
drwxr-xr-x  2 root root 4096 May 19  2020 krypton4
drwxr-xr-x  2 root root 4096 May 19  2020 krypton5
drwxr-xr-x  3 root root 4096 May 19  2020 krypton6
krypton1@krypton:/krypton$ cd krypton1
krypton1@krypton:/krypton/krypton1$ ls -la
total 16
drwxr-xr-x 2 root     root     4096 May 19  2020 .
drwxr-xr-x 8 root     root     4096 May 19  2020 ..
-rw-r----- 1 krypton1 krypton1   26 May 19  2020 krypton2
-rw-r----- 1 krypton1 krypton1  882 May 19  2020 README

In the ‘krypton1’ directory, we find two files. The ‘README’ file explains the game and gives us an additional hint on how to solve this level.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
krypton1@krypton:/krypton/krypton1$ cat README
Welcome to Krypton!

This game is intended to give hands on experience with cryptography
and cryptanalysis.  The levels progress from classic ciphers, to modern,
easy to harder.

Although there are excellent public tools, like cryptool,to perform
the simple analysis, we strongly encourage you to try and do these
without them for now.  We will use them in later excercises.

** Please try these levels without cryptool first **


The first level is easy.  The password for level 2 is in the file
'krypton2'.  It is 'encrypted' using a simple rotation called ROT13.
It is also in non-standard ciphertext format.  When using alpha characters for
cipher text 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 cipher text.

Enjoy!

The text states that the file is encrypted with ‘ROT13’. There are a lot of websites that you can use to decrypt ROT13, but I’m gonna use the command line. ROT13 is so common that you might want to create an alias.

Creating the aliases (ROT5 is not needed, but I added it anyway):

1
2
3
alias rot13="tr 'A-Za-z' 'N-ZA-Mn-za-m'"
alias rot5="tr '0-9' '5-90-4'"
alias rot="tr 'A-Za-z0-9' 'N-ZA-Mn-za-m5-90-4'"

You can use this to decrypt the cipher text.

1
2
3
4
krypton1@krypton:/krypton/krypton1$ cat krypton2
YRIRY GJB CNFFJBEQ EBGGRA
krypton1@krypton:/krypton/krypton1$ cat krypton2 | rot13
LEVEL TWO PASSWORD XXXXXX

https://overthewire.org/wargames/krypton/krypton1.html


Next Level: Level 2


Share on: