Knowledge Base · general

Stream Cipher Attacks

generaltechnique notetechniquestream-cipher-attacks

Attacking XOR-based stream ciphers by exploiting keystream reuse or weak key schedules.

How it works

  • Keystream reuse is a many-time pad: XOR two ciphertexts to cancel the key and recover XOR-of-plaintexts.
  • Recover keystream with known plaintext, then extend it by crib-dragging English text.
  • Weak key schedules (e.g. seeded PRNGs) can be reproduced from a recovered seed.

Detection & defence

  • Use a unique nonce/IV per message and authenticated encryption (AES-GCM/ChaCha20-Poly1305).
  • Never derive a keystream from a static key without a nonce.