cd ~/writeups
OverTheWire Easy Linux Cryptography

OverTheWire — Krypton: Cryptography Fundamentals

sahinyes 2023-04-07

# level progression

Level 0 → 1
Level 1 → 2

# overview

Krypton is an OverTheWire wargame focused on classical cryptography. Each level introduces a cipher or encoding scheme that must be broken to retrieve the password for the next level. This walkthrough covers the first two transitions: a straightforward credential retrieval and a ROT13 rotation cipher.

# level 0 → 1 — getting started

The Krypton wargame is hosted on the OverTheWire infrastructure. Level 0 is the entry point — connect via SSH to the Krypton server using the provided credentials to begin the challenge. The password for level 1 is given on the wargame page itself, serving as a basic introduction to the SSH-based workflow used throughout the game.

terminal bash
$ ssh krypton1@krypton.labs.overthewire.org -p 2231

→ Connected. The game directory is at /krypton/

# level 1 → 2 — rot13 rotation cipher

Level 1 tells us the password for level 2 is in the file krypton2, encrypted using a simple rotation called ROT13. The cipher text preserves word boundaries instead of grouping into 5-letter clusters, which makes the pattern easier to spot.

terminal — krypton1 bash
$ find / -type f -name "krypton2" 2>/dev/null
/krypton/krypton1/krypton2
/etc/krypton_pass/krypton2

$ ls /krypton/krypton1/
krypton2  README

$ cat /krypton/krypton1/README
...
The first level is easy.  The password for level 2 is in the file
'krypton2'.  It is 'encrypted' using a simple rotation called ROT13.
...

$ cat /krypton/krypton1/krypton2
YRIRY GJB CNFFJBEQ EBGGRA

ROT13 shifts each letter by 13 positions in the alphabet. Since there are 26 letters, applying ROT13 twice returns the original text — it is its own inverse. We can decode this using CyberChef or directly in the terminal:

terminal — decryption bash
$ echo "YRIRY GJB CNFFJBEQ EBGGRA" | tr 'A-Za-z' 'N-ZA-Mn-za-m'
LEVEL TWO PASSWORD ROTTEN

→ Password for krypton2: ROTTEN
ROT13 breakdown
Ciphertext:  Y R I R Y   G J B   C N F F J B E Q   E B G G R A
Shift -13:   L E V E L   T W O   P A S S W O R D   R O T T E N
Plaintext:   LEVEL TWO PASSWORD ROTTEN

# key takeaways

  • ROT13 is a substitution cipher — trivially reversible, never use it for actual security
  • Preserving word boundaries in ciphertext leaks structure and makes frequency analysis easier
  • CyberChef is an invaluable tool for quickly testing encoding and cipher hypotheses
  • Classical ciphers build intuition for understanding modern cryptographic primitives