Avatar
Part time CTF Player learn every day!!
🌠 I Love Hoshimachi Suisei!! 🌠
🌠 I Love Hoshimachi Suisei!! 🌠

OverTheWire Krypton Level 3 → 4 tutorial!!

Login

Log in as krypton3 using the password from Level 2 → 3.

ssh krypton3@krypton.labs.overthewire.org -p 2231
# password: CAESARISEASY

Why? Each Krypton level is a separate UNIX user. To solve 3 → 4, you must be krypton3.

Task

Task placeholder

The password for level 4 is stored in the file krypton4. You also have three ciphertext files (found1, found2, found3) encrypted with the same substitution key. This allows you to perform frequency analysis.

A little bit of Theory

  • Substitution cipher replaces each plaintext letter with another letter consistently.
  • When the same key is reused across large texts, patterns emerge.
  • In English, the most frequent letter is usually E, followed by T, A, O, I, N…
  • By comparing ciphertext frequency with expected English frequency, you can build a mapping.

Further reading:

Solution

  1. Explore the directory

    cd /krypton/krypton3
    ls -la
    

    Why? Confirm the presence of found1, found2, found3, krypton4, and hints.

    inspect placeholder

  2. Count character frequencies

    Method A (simple + stable):

    cat found1 found2 found3 | tr -cd 'A-Z' | fold -w1 | sort | uniq -c | sort -nr
    

    Method B (loop style):

    for i in {A..Z}; do
      cnt=$(cat found1 found2 found3 | tr -cd "$i" | wc -c)
      printf "%5d %s\n" "$cnt" "$i"
    done | sort -nr
    

    Why? This reveals the distribution of letters. The most frequent ciphertext letter is a candidate for mapping to E.

    freq placeholder

  3. Build a substitution mapping

    Example output:

    456 S
    340 Q
    301 J
    257 U
    ...
    

    → Guess S ≈ E, Q ≈ T, J ≈ A, … and adjust based on context. Use English frequency order: ETAOINSRHDLU…

  4. Test mapping against krypton4

    cat krypton4 | tr 'SQJUBNGCDZVWMYTXKELAFIORHP' 'EATSORNIHCLDUPYFWGMBKVXQJZ'
    

    Output:

    WELL DONE THE LEVEL FOUR PASSWORD IS BRUTE
    

    decrypt placeholder

  5. Log into the next level

    ssh krypton4@krypton.labs.overthewire.org -p 2231
    # password: BRUTE
    

Password

BRUTE

Troubleshooting

  • If the output is garbled → tweak the frequency mapping order.
  • Make sure to include all 26 letters in the tr mapping.
  • /tmp cleanup issues do not apply here — all files are in /krypton/krypton3.

Copy-paste quick run

ssh krypton3@krypton.labs.overthewire.org -p 2231
# password: CAESARISEASY

cd /krypton/krypton3
cat found1 found2 found3 | tr -cd 'A-Z' | fold -w1 | sort | uniq -c | sort -nr
# build mapping from frequency
cat krypton4 | tr 'SQJUBNGCDZVWMYTXKELAFIORHP' 'EATSORNIHCLDUPYFWGMBKVXQJZ'
# → WELL DONE THE LEVEL FOUR PASSWORD IS BRUTE

ssh krypton4@krypton.labs.overthewire.org -p 2231
# password: BRUTE

Congrats 🎉 You broke a monoalphabetic substitution with frequency analysis — welcome to krypton4!


Thanks for reading!

Until next time — Otsumachi!! 💖☄️✨

Cinema

all tags

GOT-overwrite aboutme aead ai alphanumeric-shellcode apt argc0 argon2 aslr assembly asymmetric atoi automation backbox bandit base64 bash beginner behemoth binary binary-exploitation binary-to-ascii blackarch blind blind-sqli blogging blue-team bruteforce buffer-overflow buffer-overwrite c caesar canary capabilities checksec command-injection commonmark cookie cron crypto cryptography ctf cutter cyberchef cybersecurity defenders detection dev directory-traversal dnf docs drifter ecc education elf env envp exploitation finale forensics format-string formulaone frequency frequency-analysis gcc gdb getchar gfm ghidra github-pages governance gpg guide hashing hkdf http jekyll jmpbuf kali kasiski kdf kernel keylength kramdown krypton lab ld_preload leviathan lfi lfsr linux linux-syscall llmops log-poisoning ltrace manpage markdown maze memcpy mitigations mitmproxy mlops narnia natas networking newline-injection nonce nop-sled nx object-injection obsidian openssl osint overflow overthewire package-manager pacman parrot path path-hijacking pathname php pie pkc pki pointer-trick pqc priv-esc privilege-escalation provable-security pwn pwntools pyshark python race-condition radare2 rag randomness recon red-team redirect relro requests ret2env ret2libc reverse-engineering reversing ricing roadmap rop rot13 rsa scapy security seed seo serialization session setjmp-longjmp setuid shell shellcode smoke soc sockets sprintf sql-injection srop stack-canary stack-overflow strace strcmp strcpy streamcipher strings strncpy strtoul substitution suid suisei symlink symmetric terminal test threat-intel time-based tls troubleshooting tshark type-juggling ubuntu udp utumno vigenere virtualbox virtualization vmware vortex walkthrough web windows wireshark writing wsl x86
dash theme for Jekyll by bitbrain made with