2.3 Attacks on Stream Ciphers and the One-Time Pad
The guarantees proved so far live inside a narrow model: one message, one use of the key, and an eavesdropper who only reads. That model is what makes the one-time pad perfectly secret, and it is what the security definitions later in this chapter will keep. Both guarantees evaporate the moment usage steps outside the model. Two departures recur in deployed systems. Reuse the pad and every message it protects leaks; let the attacker touch the ciphertext and she edits the plaintext without ever learning the key. This section takes up both attacks, and the real systems that fell to them.
2.3.1 The two-time pad
The pad is called “one-time” because it encrypts a single message. Suppose the same pad encrypts two.
An eavesdropper who intercepts both ciphertexts does the first thing that comes to mind: she XORs them.
The pad cancels, and what survives is not a random-looking string: it is the XOR of two plaintexts. That object leaks far more than it seems to. English text, and its ASCII encoding, carry enough redundancy that from
Notice what the attack does not use. It never touches
A stream cipher key may be used once. Encrypting
2.3.2 Reuse in deployed systems
Project Venona. In the early 1940s the Soviet Union encrypted diplomatic traffic with one-time pads whose keys were produced by hand, by throwing dice. Generating the pads was laborious, and discarding a pad after one message seemed wasteful, so pads were used for two messages and sometimes more. Beginning in 1946, US and British intelligence, working from intercepted ciphertext pairs, applied exactly the computation above and decrypted on the order of 3,000 messages over the following quarter century. Nothing about the pad design was broken; the pad had simply been used twice.
PPTP. Windows NT’s Point-to-Point Tunneling Protocol lets a client and a server exchange encrypted messages under a shared key
Each direction on its own is a legitimate single use of the pad. The flaw is between them: both streams are generated from the same seed, so both are masked by the same pad starting at the same bit, and the XOR of the two streams falls out of the XOR of the two ciphertexts. A single conversation carried its own two-time pad.
The lesson is not to avoid stream ciphers but to count pad restarts. The shared key
2.3.3 WEP: cycling counters and related keys
Wi-Fi’s original encryption layer, the one built into 802.11b and called WEP, is a case study in how to reproduce the two-time pad while trying to avoid it. A client and an access point share a long-term key
The designers knew the rule of Section 2.3.1. A stream cipher key is good for one message, so they changed the key for every frame by prepending the counter. Two failures followed.
The counter cycles. The IV has
The keys are related. Even before any wrap, the keys were never independent. Frame 1 uses
The security definitions of Sections 2.5 and 2.6 will make the second failure precise: when we analyze a construction whose keys are related in this way, the proof of security simply cannot go through. Changing the key “a little” is not changing the key.
What should WEP have done? Treating the whole exchange as one long stream under one key removes the problem by construction: the first segment of the pad encrypts frame 1, the second segment frame 2, and the pad never restarts. If per-frame keys are wanted instead, they should be derived rather than counter-prefixed: feed
2.3.4 Stream ciphers on disk
One more setting where reuse is unavoidable, and instructive. Suppose a disk encrypts files with a stream cipher under a fixed key. A file begins with the words To: Bob and is saved; later the user opens it, changes the address to To: Eve, and saves again.
Two things go wrong at once. First, the two versions of the file are two messages encrypted under the same pad: a two-time pad between a file and its own revision, with all the consequences of Section 2.3.1. Second, the pad is positional: bit
Disk encryption, then, is not a setting for stream ciphers. The general rules this tour leaves behind are short enough to memorize:
- Never use a stream cipher key, or a pad, more than once.
- Network traffic: negotiate a fresh key for every session (as TLS does), and use one key per direction within a session.
- Disk encryption: use something other than a stream cipher.
2.3.5 Malleability
Every attacker so far was an eavesdropper. The threat model of Chapter 1 allowed more: the channel is not just observed but modified. The pad and the stream cipher hand the attacker that power for free. Let
be an intercepted ciphertext, and let the attacker replace it with
Nothing flags the tampering, and its effect is exactly known: whatever the attacker XORs into the ciphertext comes out XORed into the plaintext. She never learns
Definition (malleable)
A cipher is malleable if an attacker who intercepts a ciphertext
Here is what malleability buys. A message begins with the header From: Bob; the attacker wants the recipient to read From: Eve. She holds no key and cannot encrypt a message of her own from scratch, but she knows the difference between the two names. In ASCII, writing the byte values in hexadecimal,
So she XORs 07 19 07 into the ciphertext at the offset of the name, and the recipient decrypts From: Eve. A ciphertext saying something she chose, in a message she never read, now exists, obtained by editing a ciphertext she overheard.
The cipher has kept its promise, the one that matters to an eavesdropper: the ciphertext reveals nothing about the plaintext. What it never promised, and cannot deliver, is that the ciphertext is the message the sender sent. Confidentiality without integrity is half a guarantee, and for the traffic that real systems carry, the missing half is the one that hurts. Integrity arrives with message authentication codes in Chapter 5, and encryption that provides both properties at once, in Chapter 6.