skip to main content
hacking.communityplay in the sandbox.

Crack the Leaked XOR Keystream

crypto · medium · +75 XP

XOR Encryption — Symmetric and Fragile

XOR (exclusive-OR) is one of the simplest symmetric cipher primitives: each byte of plaintext is combined with a corresponding byte of the key using the ^ operator. Because XOR is its own inverse, the same operation encrypts and decrypts — just XOR the ciphertext with the same key again.

Why Short, Static Keys Are Dangerous

When the key is shorter than the message it is repeated (a technique known as Vigenère-style key repetition). If an attacker discovers the key — through source-code leaks, firmware dumps, or simple guessing — the entire ciphertext collapses instantly. This lab simulates exactly that scenario: the key was found hard-coded in a public Git repository.

Your Mission

You are given a hex-encoded XOR-encrypted blob and the leaked key s3cr3tK3y. Decode the hex to raw bytes, then XOR every byte with the repeating key to recover the plaintext flag.

Recommended Tools

  • Python one-liner: python3 -c "import binascii; ct=bytes.fromhex('BLOB'); key=b's3cr3tK3y'; print(bytes(c^key[i%len(key)] for i,c in enumerate(ct)).decode())"
  • CyberChef: pipe From Hex → XOR (key s3cr3tK3y, UTF-8, Standard)
  • openssl / xxd can help inspect raw bytes if you prefer shell tools
// graded hints — spend XP when stuck

Sign in to unlock escalating hints for this medium lab.

// captured payload · xor
1b50180a5c0666581c0a4017005615261e151652085f02447a6c404a565745504378061a100a1e

XOR the bytes against the key `s3cr3tK3y` (UTF-8, repeating).

// this payload is unique to your account — decode it, then submit the recovered hc{...} flag below

// submit flag
// no solves yet
17 of 17 · crypto

// go deeper

// install app

Install hacking.community for fast access, offline reading, and push notifications. No app store needed.