EC-Council Certified Ethical Hacker (CEH) v12CryptographyHard

An ethical hacker is performing a cryptographic analysis on an embedded system that uses a custom stream cipher. They discover that the cipher reuses the same key stream for multiple messages encrypted with the same key. What is the most significant cryptographic attack that this vulnerability enables?

  1. ATwo-time pad attack (XORing ciphertexts)
  2. BSide-channel analysis
  3. CPadding oracle attack
  4. DReplay attack
Show answer & explanation

Correct answer: A. Two-time pad attack (XORing ciphertexts)

A stream cipher works by producing a keystream which is then XORed with the plaintext to produce ciphertext. If the same keystream is reused with different plaintexts (a 'two-time pad' scenario), an attacker can XOR the two ciphertexts together. This cancels out the keystream, revealing the XOR of the two plaintexts (C1 XOR C2 = (P1 XOR K) XOR (P2 XOR K) = P1 XOR P2), which can often be cryptanalyzed to recover the original plaintexts, completely compromising confidentiality.

Why the other options are wrong

  • B. Side-channel analysis exploits physical characteristics (e.g., power consumption, timing), not a logical flaw in keystream generation.
  • C. Padding oracle attacks apply to block ciphers in CBC mode, not stream ciphers.
  • D. Replay attacks involve re-sending valid data, not decrypting it by exploiting keystream reuse.

Two-Time Pad Attack

A two-time pad attack occurs when a stream cipher (or one-time pad) reuses the same keystream to encrypt two or more different plaintexts. This allows an attacker to XOR the ciphertexts, which cancels out the keystream and reveals the XOR of the original plaintexts, compromising confidentiality.

  • Specific to stream ciphers or one-time pads.
  • Occurs with keystream reuse.
  • XORing ciphertexts reveals XOR of plaintexts.
  • Completely compromises confidentiality.

Memory trick: Stream ciphers fear keystream reuse; two-time pad is doom.

More Cryptography questions