From WEP to WPA3: What Each Generation Fixed
Wi-Fi security has been redesigned three times in twenty years, and each redesign is a lesson in what goes wrong when cryptography is assembled from parts that look reasonable. WEP used a respectable stream cipher and a checksum and still failed completely; WPA was a patch that had to run on WEP hardware; WPA2 got the cryptography right but left the passphrase exposed to offline guessing; WPA3 closed that gap and made management-frame protection mandatory. Knowing why each step was needed tells you what an old device on your network really exposes. The one-table overview is in the survey course's Wireless Security; this lesson shows the mechanisms.
WEP (1997–1999): three design flaws
WEP (Wired Equivalent Privacy, in the original IEEE 802.11 standard) encrypted each frame with RC4, keyed by a 24-bit IV sent in the clear followed by the shared 40- or 104-bit key, and appended an ICV, a CRC-32 of the plaintext, inside the encryption.
- IV reuse. A 24-bit IV has only 16.7 million values. Two frames with the same IV use the same keystream, and the XOR of their ciphertexts is the XOR of their plaintexts.
- No real integrity. CRC-32 is linear: the change in the CRC caused by flipping bits depends only on the flipped bits. An attacker can flip bits in a ciphertext and fix the encrypted ICV without knowing the key.
- Key recovery from weak IVs. RC4's first output bytes leak information about the key when the key is the IV followed by a fixed secret. Fluhrer, Mantin and Shamir described this in 2001; later attacks (Klein; Tews, Weinmann and Pyshkin, 2007) needed only tens of thousands of frames, about a minute of traffic.
The model below writes a toy WEP (RC4 in a few lines, a 40-bit lab key) and demonstrates the first two flaws on frames it encrypts itself. The third needs many frames and is described, not run.
import zlib, struct, math
def rc4(key, n): # RC4 keystream (toy, for the WEP model only; never use RC4)
S = list(range(256)); j = 0
for i in range(256):
j = (j + S[i] + key[i % len(key)]) % 256; S[i], S[j] = S[j], S[i]
i = j = 0; out = bytearray()
for _ in range(n):
i = (i + 1) % 256; j = (j + S[i]) % 256; S[i], S[j] = S[j], S[i]
out.append(S[(S[i] + S[j]) % 256])
return bytes(out)
def xor(a, b): return bytes(x ^ y for x, y in zip(a, b))
def icv(p): return struct.pack("<I", zlib.crc32(p))
KEY = bytes.fromhex("0102030405") # a 40-bit lab key
def wep_encrypt(iv, plaintext):
body = plaintext + icv(plaintext)
return iv, xor(body, rc4(iv + KEY, len(body)))
def wep_decrypt(iv, c):
body = xor(c, rc4(iv + KEY, len(c)))
p, tag = body[:-4], body[-4:]
return p, tag == icv(p)
# 1. The same IV means the same keystream: XOR of two ciphertexts = XOR of the plaintexts.
iv = bytes.fromhex("00002a")
_, c1 = wep_encrypt(iv, b"PAY alice 0010 EUR")
_, c2 = wep_encrypt(iv, b"PAY bobby 9999 EUR")
print("c1 xor c2 == p1 xor p2:", xor(c1, c2)[:18] == xor(b"PAY alice 0010 EUR", b"PAY bobby 9999 EUR"))
# 2. CRC-32 is linear: flip bits in the ciphertext and fix the encrypted ICV without the key.
p = b"PAY alice 0010 EUR"
delta = xor(p, b"PAY alice 9010 EUR")
fix = xor(icv(delta), icv(bytes(len(p)))) # crc(p^d) = crc(p) ^ crc(d) ^ crc(0...0)
forged = xor(c1, delta + fix)
print("forged frame decrypts to:", wep_decrypt(iv, forged))
# 3. 24-bit IVs repeat soon (birthday bound).
N = 2 ** 24
for frames in (1000, 5000, 20000):
print(f"{frames:>6} frames: P(some IV repeats) = {1 - math.exp(-frames * (frames - 1) / (2 * N)):.2f}")c1 xor c2 == p1 xor p2: True
forged frame decrypts to: (b'PAY alice 9010 EUR', True)
1000 frames: P(some IV repeats) = 0.03
5000 frames: P(some IV repeats) = 0.53
20000 frames: P(some IV repeats) = 1.00
The forged frame says 9010 instead of 0010, and the receiver's integrity check passes: a CRC detects noise, not an adversary. That is the general lesson, the same one as for HMAC: integrity against attackers needs a keyed MAC. The birthday numbers explain the first flaw: after about 5,000 frames, a repeated IV is more likely than not.
WPA (2003): a patch for WEP hardware
The Wi-Fi Alliance published WPA as an interim, built on the draft 802.11i, so that existing hardware could be fixed by a firmware update. Its TKIP kept RC4 but added:
- a per-packet key mixed from the session key, the transmitter address and a 48-bit sequence counter (TSC), so no two frames share an RC4 key and weak-IV attacks stop;
- the TSC as a replay counter;
- Michael, a lightweight keyed MIC instead of CRC-32, with "countermeasures" (shut down for a minute after two MIC failures within a minute) because Michael itself was weak.
TKIP was a success as a stop-gap and is now deprecated: attacks on it (Beck and Tews, 2008, and later work on RC4 biases) allow decrypting and injecting short frames. Devices and configurations offering TKIP should be updated, and Wi-Fi certification no longer allows TKIP-only networks.
WPA2 (2004): IEEE 802.11i, done properly
WPA2 is the Wi-Fi Alliance's name for the full IEEE 802.11i amendment (2004, merged into IEEE 802.11-2007):
- CCMP: AES-128 in CCM mode (CTR encryption plus a CBC-MAC), a proper authenticated encryption with a 48-bit packet number as nonce and replay counter;
- the 4-way handshake to derive fresh per-session keys from the PMK (next section);
- Personal (PSK) and Enterprise (802.1X) modes.
Its weaknesses were not in AES: WPA2-Personal lets anyone who captures a handshake test passphrase guesses offline, management frames were unprotected unless PMF was turned on, and implementations had the KRACK bugs (2017).
WPA3 (2018): the current generation
| Feature | WPA2 | WPA3 |
|---|---|---|
| Personal authentication | PSK, PMK = PBKDF2(passphrase, SSID) | SAE (Dragonfly): no offline guessing, forward secrecy |
| Management frame protection | optional | mandatory (PMF required) |
| Enterprise | 802.1X, usually CCMP-128 | 802.1X; optional 192-bit mode (GCMP-256, HMAC-SHA-384, Suite B/CNSA-style ciphers) |
| Open networks | unencrypted | Enhanced Open (OWE, a separate certification): encrypted, unauthenticated |
| Transition | — | WPA2/WPA3 transition mode for mixed clients, with its own risks |
The 6 GHz band (Wi-Fi 6E and later) allows only WPA3 or Enhanced Open: no WPA2 and no open networks there.
How old protocols are detected on your network
- Beacon audit: the RSN element lists ciphers and AKMs (previous lesson); the older WPA element (vendor-specific, Microsoft OUI) or the Privacy bit without any RSN element means WPA-TKIP or WEP.
- Controller and AP inventories: per-SSID security settings, and the list of clients connected with each cipher.
- Client inventories: devices that only support WPA2 or TKIP, often printers, scanners, old IoT and medical devices.
How it is fixed
- WEP and TKIP: remove them. No configuration makes them safe. Devices that can't do better go on an isolated network or get replaced.
- WPA2: CCMP only, a long random passphrase, PMF enabled; prefer Enterprise for organisations.
- WPA3: SAE with PMF required wherever every client supports it; transition mode only as a planned, temporary step.
Pitfalls
- "WPA2" in a menu that also offers "WPA/WPA2 mixed": the mixed mode keeps TKIP for old clients.
- Treating a CRC or checksum as integrity protection, in Wi-Fi or in your own protocols.
- Assuming the cipher is the weak point: from WPA2 on, attacks target passphrases, handshake implementations and configuration.
Practice
1. Why can't a longer WEP key (104 instead of 40 bits) fix IV reuse?
The IV is still 24 bits, so keystreams still repeat after a few thousand frames, and CRC-32 is still linear. Key length doesn't touch either flaw; the weak-IV key-recovery attacks also scale only mildly with key length.
2. In the program, change the forged amount to 0019. Does the ICV still verify? Why?
Yes. Any change works: delta is the XOR of the old and new plaintexts, and the CRC correction depends only on delta, not on the key or the rest of the message.
3. What did TKIP change so that the weak-IV attacks on RC4 stopped?
It mixed a fresh RC4 key for every packet from the session key, the transmitter address and a 48-bit counter, so the attacker never sees many frames under keys of the form "known IV + fixed secret".
Test yourself
Why could WEP frames be modified without detection?
- RC4 is a block cipher
- The ICV was CRC-32, which is linear and unkeyed
- Frames were not encrypted
- The IV was 128 bits
After about how many frames is a repeated 24-bit IV more likely than not?
- About 50
- About 5,000
- About 16 million
- Never
Which cipher does WPA2's CCMP use?
- RC4
- AES-128 in CCM mode
- DES
- ChaCha20
What does the 6 GHz band allow?
- WEP and WPA2
- Only WPA3 or Enhanced Open
- Only open networks
- Only TKIP