Skip to main content

Settings

Color Mode

Theme Skin

Background

Appearance preferences are saved in this browser only.

Environment

Current Environment Production

Built with JEKYLL_ENV=production. Changes require deployment.

Theme & Build

Jekyll v3.10.0
Last BuildOct 17, 19:54

Page Info

Layout default
Collection none
Path overthewire/bandit/bandit12.md
URL /docs/wargames/bandit/bandit12/
Date 2026-04-07

Source Code

Set repository: USER/REPO in your _config.yml to enable source-code shortcuts.

Bandit12

Bandit Level 12 — undo a ROT13 substitution cipher with the tr command.

Source: This content is aggregated from overthewire (MIT). Visit the original repository for the latest version.

Level Goal

The password for the next level is stored in the file data.txt, where all lowercase (a-z) and uppercase (A-Z) letters have been rotated by 13 positions

Commands you may need to solve this level

grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd

Helpful Reading Material

Study guide

Level map: logged in as bandit11, find the password for bandit12.

What this level teaches

Substitution ciphers, and character translation with tr.

Key ideas

  • ROT13 replaces each letter by the one 13 places later in the alphabet, wrapping around. Because the alphabet has 26 letters, applying ROT13 twice returns the original, so the same operation encrypts and decrypts.
  • tr SET1 SET2 replaces each character of the first set with the corresponding character of the second. Ranges such as a-e are allowed, so tr 'a-e' 'A-E' upper-cases only those five letters.
  • ROT13 is trivially reversible and provides obfuscation, not security.

How to approach it

  1. Work out by hand where A and a land after a 13-place shift, and write the two sets so every letter is covered.
  2. Remember upper and lower case need their own ranges.
  3. Test your tr command on a word you encode yourself before applying it to the real file.

Why it matters

This is the first step of Krypton, where simple ciphers like this are attacked systematically with frequency analysis.