← Back to Writeups
CUSTOMEasyCrypto

ROX — XOR with Key

XESXOR9/2/20261 min read
#crypto#custom#easy#key_recovery#known_plaintext_xor_attack

ROX — XOR with Key

Platform: CUSTOM | Category: Crypto | Type: Challenge | Difficulty: Easy | OS: N/A | **Author: XESXOR Techniques: key_recovery, known_plaintext_xor_attack

Summary

Walkthrough of the CUSTOM Crypto ROX — XOR with Key. Task: Decode a 280-bit binary string. Solution: Known plaintext XOR attack using flag prefix to recover repeating key.

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
#!/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}

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

Key Takeaways / Lessons

  • Mastering key_recovery, known_plaintext_xor_attack was key to this challenge.
  • Always check for common misconfigurations and verify assumptions.

Crafted by XESXOR Research • 2026-03-08 • CUSTOM • ROX — XOR with Key • Difficulty: Easy