← Back to Writeups
CUSTOMEasyCrypto

Caesar

XESXOR9/2/20262 min read
#crypto#custom#easy#caesar_shift#known_plaintext_attack

Caesar

Platform: taipanbyte | Category: Crypto | Type: Challenge | Difficulty: Easy | OS: NA | Author: XESXOR | Date: 2026-02-14 | Status: Solved Techniques: caesar_shift, known_plaintext_attack

Summary

Task: Decrypt a Caesar-cipher encoded flag. Solution: Use known-plaintext attack with the TB{ flag prefix to determine shift value of +8, then apply the shift to all alphabetic characters while preserving digits and special characters.

Caesar — taipanbyte CTF

Description

Попробуй расшифровать это:
LT{ymqk_lz1k_1k_f0l_k3j1gmk}

Flag format: TB{...}

Analysis

  1. The ciphertext LT{ymqk_lz1k_1k_f0l_k3j1gmk} has the structure XX{...} matching the flag format TB{...}
  2. Known-plaintext attack using the flag prefix:
    • L should be T: shift = ord('T') - ord('L') = 84 - 76 = +8
    • T should be B: shift = (ord('B') - ord('T')) % 26 = (66 - 84) % 26 = +8 (confirmed)
  3. Non-alphabetic characters ({, }, _, digits 1, 0, 3) are preserved — classic Caesar cipher behavior
  4. This is a standard Caesar cipher with shift +8 ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Solution

Key Insight

The flag format TB{...} gives us a known plaintext prefix. Comparing LT (ciphertext) with TB (expected plaintext) immediately reveals the shift value of +8. Since Caesar cipher uses a fixed shift for all characters, this single observation is enough to decrypt the entire message.

Manual Verification

Checking a few characters with shift +8:

  • L + 8 = T
  • T + 8 = B
  • y + 8 = g
  • m + 8 = u
  • q + 8 = y
  • k + 8 = s

So ymqk -> guys — makes sense! ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Solve Script

python
#!/usr/bin/env python3
text = 'LT{ymqk_lz1k_1k_f0l_k3j1gmk}'
shift = 8

result = ''
for c in text:
    if c.isalpha():
        base = ord('A') if c.isupper() else ord('a')
        result += chr((ord(c) - base + shift) % 26 + base)
    else:
        result += c

print(result)  # TB{REDACTED}

Output

TB{REDACTED}

Lessons Learned

  1. Always use the known flag format as a crib for known-plaintext attacks
  2. Caesar cipher is the simplest substitution cipher — just a fixed shift of the alphabet
  3. Two known plaintext-ciphertext character pairs are enough to confirm Caesar (vs. other ciphers)
  4. Leet speak (digits replacing letters like 1 for i, 0 for o, 3 for e) is unaffected by Caesar shift since only alphabetic characters are rotated ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍