ROX — XOR with Key
XESXOR9/10/20261 min read
#crypto#custom#easy#key_recovery#known_plaintext_xor_attack
ROX — XOR with Key
Platform: spbctf | Category: Crypto | Type: Challenge | Difficulty: Easy | OS: NA | Author: XESXOR | Date: 2026-03-08 | Status: Solved Techniques: key_recovery, known_plaintext_xor_attack
Summary
Task: Decode a 280-bit binary string. Solution: Known plaintext XOR attack using flag prefix to recover repeating key.
ROX — Crypto Kids 2.0
Description
Binary string to decode (280 bits).
Analysis
The name "ROX" is "XOR" reversed. Encryption: plaintext XOR repeating_key.
Using known plaintext attack: knowing that the flag starts with "spbctf{", XOR the first bytes of ciphertext with "spbctf{" to recover the key.
Solution
python read-only • copy allowed#!/usr/bin/env python3 # Binary string (280 bits = 35 bytes) binary = "0010101100111011001110110010110100101011001110010010101100110101001110110010101100110100001110010010101100110101001110010010101100110101001110110010101100110101001110010010101100110101001110010010101100110101001110010010101100110101001110010010101100110101001110010010101100110101001110010010101100110101" # Convert to bytes ciphertext = bytes(int(binary[i:i+8], 2) for i in range(0, len(binary), 8)) # Known plaintext attack known = b"spbctf{" key_fragment = bytes(c ^ p for c, p in zip(ciphertext[:7], known)) print(f"Key fragment: {key_fragment}") # b'XORXORX' -> key = "XOR" key = b"XOR" # Decrypt plaintext = bytes(c ^ key[i % len(key)] for i, c in enumerate(ciphertext)) print(plaintext.decode()) # Output: spbctf{REDACTED}