← Back to Writeups
CUSTOMEasyCrypto

Брутфорс

XESXOR9/10/20262 min read
#crypto#custom#easy#caesar_shift_bruteforce#known_plaintext_attack

Брутфорс

Platform: duckerz | Category: Crypto | Type: Challenge | Difficulty: Easy | OS: NA | Author: XESXOR | Date: 2026-01-09 | Status: Solved Techniques: caesar_shift_bruteforce, known_plaintext_attack

Summary

Task: Caesar cipher encrypted Lorem Ipsum text with embedded flag. Solution: Bruteforce all 26 shifts using known flag format DUCKERZ{} to determine shift of +11.

Брутфорс — duckerz

Description

"А ведь именно брут убил цезаря" (Translation: "After all, it was Brutus who killed Caesar")

File: crypt1.txt

Analysis

  1. Hint in description: "Brutus killed Caesar" — direct hint at Caesar cipher
  2. Encrypted text: Lorem Ipsum placeholder text with embedded flag
  3. Encrypted flag: SJRZTGO{a0g3b_1E5jB}
  4. Known flag format: DUCKERZ{...}

Determining the shift

Comparing encrypted prefix SJRZTGO with known DUCKERZ:

EncryptedSJRZTGO
PlaintextDUCKERZ
Shift+11+11+11+11+11+11+11
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Shift = +11 (or -15, which is equivalent)

Solution

python
#!/usr/bin/env python3
"""Caesar cipher bruteforce for duckerz CTF"""

def caesar_cipher(text, shift):
    """Apply Caesar cipher with given shift"""
    result = ""
    for char in text:
        if char.isalpha():
            start = ord('A') if char.isupper() else ord('a')
            result += chr((ord(char) - start + shift) % 26 + start)
        else:
            result += char
    return result

# Encrypted flag from crypt1.txt
encrypted_flag = "SJRZTGO{a0g3b_1E5jB}"
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

# Bruteforce all 26 shifts
print("Bruteforcing Caesar cipher:")
print("-" * 40)
for shift in range(26):
    decrypted = caesar_cipher(encrypted_flag, shift)
    marker = " <-- FLAG!" if decrypted.startswith("DUCKERZ{") else ""
    print(f"Shift {shift:2}: {decrypted}{marker}")

Output

Bruteforcing Caesar cipher:
----------------------------------------
Shift  0: SJRZTGO{a0g3b_1E5jB}
Shift  1: TKSAUHP{b0h3c_1F5kC}
Shift  2: ULTBVIQ{c0i3d_1G5lD}
Shift  3: VMUCWJR{d0j3e_1H5mE}
Shift  4: WNVDXKS{e0k3f_1I5nF}
Shift  5: XOWEYLT{f0l3g_1J5oG}
Shift  6: YPXFZMU{g0m3h_1K5pH}
Shift  7: ZQYGANV{h0n3i_1L5qI}
Shift  8: ARZHBOW{i0o3j_1M5rJ}
Shift  9: BSAICPX{j0p3k_1N5sK}
Shift 10: CTBJDQY{k0q3l_1O5tL}
Shift 11: DUCKERZ{REDACTED} <-- FLAG!
...

‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Notes

  • Flag l0r3m_1P5uM is a leetspeak version of "Lorem Ipsum", matching the encrypted text
  • Caesar cipher is one of the simplest substitution ciphers, easily broken by bruteforcing 26 variants
  • Known-plaintext attack: knowing the flag format DUCKERZ{, the shift can be instantly determined ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍