WiFi Security
WEP Weaknesses
Read aloud is unavailable in this browser.
The Birth and Death of WEP
Wired Equivalent Privacy (WEP) was introduced in 1997 as part of the original IEEE 802.11 wireless networking standard. Its name reveals its ambition: to provide wireless networks with security equivalent to that of a wired Ethernet connection. In wired networks, physical access to the cable is required to eavesdrop—WEP aimed to create a similar barrier for wireless communications.
Today, WEP stands as one of the most famous examples of failed security design in computing history. Understanding why WEP failed is not merely historical curiosity—it provides fundamental lessons in cryptographic protocol design that remain relevant for understanding modern security mechanisms.
WEP is fundamentally broken and should never be used. Any WEP-protected network can be compromised in minutes using freely available tools. If you encounter WEP in production, treat it as equivalent to having no security at all.
By the end of this page, you will understand WEP's cryptographic architecture, the specific design flaws that made it vulnerable, how attacks like the Fluhrer-Mantin-Shamir (FMS) and PTW attacks work conceptually, and why WEP remains an essential case study in security protocol design.
WEP Design Goals and Architecture
WEP was designed to achieve three primary security objectives:
1. Confidentiality Preventing unauthorized parties from reading transmitted data. Even if attackers capture wireless packets (trivial with the right equipment), the encrypted content should be indecipherable without the secret key.
2. Data Integrity Ensuring that data is not modified in transit. Recipients should be able to verify that received packets are identical to what was sent, detecting any tampering.
3. Access Control Preventing unauthorized stations from connecting to and using the wireless network. Only clients with the correct key should be able to authenticate and communicate.
These goals are sound—the failure lay entirely in how WEP attempted to achieve them.
- •Shared Secret Key — A pre-shared key (PSK) of either 40 or 104 bits, known to all authorized clients and the access point. Combined with a 24-bit Initialization Vector (IV) to form the complete key.
- •RC4 Stream Cipher — A symmetric stream cipher that generates a pseudorandom keystream based on the combined key. The keystream is XORed with plaintext to produce ciphertext.
- •Initialization Vector (IV) — A 24-bit value transmitted in plaintext with each frame. Designed to ensure different keystreams for different packets, preventing identical encryptions.
- •CRC-32 Integrity Check Value (ICV) — A 32-bit cyclic redundancy check computed over the plaintext data, encrypted along with the payload to detect modifications.
The WEP Encryption Process:
1. Compute ICV = CRC-32(plaintext)
2. Append ICV to plaintext: P' = plaintext || ICV
3. Concatenate IV with shared key: K = IV || SharedKey
4. Generate keystream: RC4(K) → keystream
5. Produce ciphertext: C = P' ⊕ keystream
6. Transmit: IV || C
The IV is sent in the clear because the receiver needs it to reconstruct the same keystream for decryption. This design decision, combined with the small IV space, proved catastrophic.
WEP is often marketed as '64-bit' or '128-bit' encryption. However, the actual secret key is only 40 or 104 bits respectively. The remaining 24 bits are the IV, which is public. True security strength is determined by the secret portion only.
Understanding the RC4 Stream Cipher
WEP's choice of RC4 was significant. RC4 (Rivest Cipher 4), designed by Ron Rivest in 1987, was popular for several reasons:
Advantages of RC4:
- Speed: RC4 is exceptionally fast in software, important for resource-constrained wireless devices of the late 1990s.
- Simplicity: Easy to implement in low-power hardware without complex operations.
- Variable key length: Supports keys from 8 to 2048 bits, providing flexibility.
- No block boundaries: As a stream cipher, there's no padding required regardless of message length.
However, RC4's security properties have subtle requirements that WEP violated.
How RC4 Works:
RC4 operates in two phases:
Key Scheduling Algorithm (KSA):
- Initialize a 256-byte state array S with values 0-255
- Permute S using the key bytes:
for i = 0 to 255: j = (j + S[i] + key[i mod keylen]) mod 256 swap(S[i], S[j]) - The final state S becomes the cipher's internal state
Pseudo-Random Generation Algorithm (PRGA): For each output byte:
i = (i + 1) mod 256
j = (j + S[i]) mod 256
swap(S[i], S[j])
output S[(S[i] + S[j]) mod 256]
The PRGA produces a keystream—a sequence of pseudorandom bytes that appear random but are deterministic given the key. XORing this keystream with plaintext produces ciphertext.
A stream cipher's security absolutely depends on never reusing the same keystream. If two messages M1 and M2 are encrypted with the same keystream K, then C1 ⊕ C2 = M1 ⊕ M2 (the keystream cancels out). This reveals relationships between plaintexts and can lead to full decryption.
Why RC4 Itself Is Not the Problem:
While RC4 has known biases in its keystream (the first bytes are not uniformly distributed), these weaknesses alone don't break WEP. The catastrophic failures came from how WEP used RC4:
-
Prepending the IV to the key: RC4 was designed for keys that appear random. The WEP key format (known IV + secret key) creates patterns that leak information.
-
Related-key structure: All WEP keys for a given network share the same suffix (the secret key). This creates what cryptographers call 'related keys'—a serious weakness when the relationship is predictable.
-
Weak key scheduling: RC4's KSA doesn't fully mix key bits before producing output. The first few keystream bytes are statistically correlated with key bytes—especially when keys have structure like WEP's.
The Fatal Initialization Vector Problem
The 24-bit Initialization Vector is perhaps WEP's most critical design flaw. Multiple catastrophic vulnerabilities stem directly from this choice:
Problem 1: IV Space Exhaustion
With only 24 bits, there are exactly 2²⁴ = 16,777,216 possible IVs. This sounds like a large number, but consider modern wireless traffic:
- A typical 802.11 frame is ~1500 bytes
- At 54 Mbps (802.11g), that's approximately 4,500 frames per second
- 16.7 million frames ÷ 4,500 frames/second = ~3,700 seconds ≈ 1 hour
In a busy network, IV reuse is guaranteed within approximately one hour of heavy traffic. Even with lighter loads, reuse typically occurs within a few hours.
| Network Speed | Frames/Second | Time to IV Exhaustion |
|---|---|---|
| 11 Mbps (802.11b) | ~1,000 | ~4.7 hours |
| 54 Mbps (802.11g) | ~4,500 | ~1.0 hour |
| 130 Mbps (802.11n) | ~10,000 | ~28 minutes |
| 433 Mbps (802.11ac) | ~35,000 | ~8 minutes |
Problem 2: No IV Uniqueness Enforcement
The 802.11 standard doesn't mandate how IVs should be generated or that they must be unique. Common implementations used:
- Sequential IVs: Starting from 0 and incrementing. Predictable and often reset on reboot.
- Random IVs: Collision probability follows the birthday paradox—50% collision probability after only ~4,823 frames (√(2 × 2²⁴)).
- Counter with resets: Counters that reset to 0 on driver reload, card reset, or firmware update.
None of these approaches prevent IV reuse in practice.
Problem 3: Weak IVs and Key Correlation
The Fluhrer, Mantin, and Shamir (FMS) attack discovered in 2001 identified that certain IVs—called 'weak IVs'—leak information about the secret key bytes.
Specifically, when the first three bytes of the IV+Key concatenation have a specific relationship, the first keystream byte has a strong statistical bias toward revealing a key byte. The pattern:
IV of form: (A+3, N-1, X) where:
- A is the target key byte index
- N is 256
- X is any value
With approximately 2%–5% of IVs being 'weak' for each key byte, collecting enough traffic to solve the entire key becomes feasible.
Modern tools like aircrack-ng can crack a WEP key in as little as 60 seconds to a few minutes, given sufficient captured traffic. The attack requires capturing approximately 40,000-80,000 packets for a 104-bit key. Techniques like ARP replay injection can generate this traffic artificially.
The CRC-32 Integrity Failure
WEP's choice of CRC-32 for integrity protection represents a fundamental misunderstanding of the difference between error detection and cryptographic integrity.
What CRC-32 Was Designed For:
Cyclic Redundancy Check (CRC) algorithms detect accidental errors in data—bit flips, electrical interference, transmission noise. They are optimized for speed and can detect common error patterns with high probability.
What CRC-32 Cannot Do:
CRC is not cryptographically secure. It has no keyed input—anyone can compute the CRC of any message. More critically, CRC is linear:
CRC(A ⊕ B) = CRC(A) ⊕ CRC(B)
This linearity is devastating when combined with stream cipher encryption.
The Bit-Flipping Attack:
Because XOR is also linear, an attacker can modify encrypted WEP packets without knowing the key:
- Let C = P ⊕ K (ciphertext = plaintext XOR keystream)
- Attacker computes a modification mask M
- Attacker transmits C' = C ⊕ M
- When decrypted: P' = C' ⊕ K = (C ⊕ M) ⊕ K = P ⊕ M
The attacker has modified the plaintext in a predictable way without knowing the key!
The CRC must also be modified to match. Due to CRC linearity:
New CRC = Old CRC ⊕ CRC(M)
Both values can be computed without knowing the original plaintext or key.
Attackers can use bit-flipping to modify known fields in packets. For example, changing the destination IP address in an ARP response to redirect traffic, modifying TCP sequence numbers to inject data, or altering DNS responses to redirect victims to malicious sites.
Why This Matters:
WEP's integrity check provides zero protection against malicious modification. An attacker who can capture one encrypted packet can:
- Modify specific bits in the encrypted payload
- Adjust the encrypted CRC to match
- Rebroadcast the modified packet
- The receiver will accept it as valid
This attack requires no key knowledge—only understanding of the packet structure being modified. Combined with the ability to inject packets, attackers gain significant control over network communications.
Authentication Mechanism Weaknesses
WEP defined two authentication modes, both fundamentally flawed:
Open System Authentication:
This mode performs no actual authentication—the client sends an authentication request, and the AP accepts it. The WEP key is only used for encryption after association. While this sounds insecure, it's actually no worse than the alternative.
Shared Key Authentication:
This mode attempts to prove knowledge of the WEP key through a challenge-response protocol:
- Client sends authentication request
- AP sends a 128-byte random challenge (cleartext)
- Client encrypts challenge with WEP and sends back
- AP decrypts and verifies challenge matches
- If match, client is authenticated
The Shared Key Attack:
Paradoxically, Shared Key Authentication is less secure than Open Authentication. The problem:
- Attacker captures the authentication exchange
- Attacker now has: Challenge (plaintext) and Response (ciphertext)
- Keystream = Challenge ⊕ Response (for the IV used in that response)
- This keystream can be reused with the same IV!
Exploitation:
Step 1: Capture authentication: Challenge_plaintext, Response_ciphertext, IV
Step 2: Derive keystream: K = Challenge ⊕ Response
Step 3: Create new authentication request
Step 4: When challenged, encrypt with K using same IV
Step 5: AP accepts—attacker is authenticated
The attacker has authenticated without knowing the WEP key by replaying the keystream.
The IEEE 802.11 specification recommends Open Authentication because Shared Key Authentication actively weakens security. The 'more secure' authentication option provides less security—a counterintuitive result that confused many administrators.
Additional Authentication Problems:
- No mutual authentication: The client cannot verify the AP's identity, enabling rogue AP attacks.
- No per-client keys: All clients share the same PSK, so compromising one client compromises all.
- No session key derivation: The same key is used for all traffic indefinitely, preventing key rotation.
- Replay vulnerability: No mechanism prevents capture and retransmission of valid encrypted frames.
Evolution of Practical WEP Attacks
The theoretical weaknesses in WEP were progressively weaponized into increasingly efficient attacks:
2001 — The FMS Attack (Fluhrer-Mantin-Shamir):
The foundational attack that proved WEP was fundamentally broken:
- Identified weak IV patterns that leak key bytes
- Required ~4-6 million packets for reliable key recovery
- Took several hours of packet capture on busy networks
- Could be mitigated (but not fixed) by filtering weak IVs
2004 — The KoreK Attack (Improved FMS):
Dramatically reduced the number of packets needed:
- Discovered 16 additional correlations beyond FMS
- Reduced packet requirements to ~500,000-1,000,000
- Key recovery possible in 10-30 minutes
- Weak IV filtering became ineffective
2005 — The Chopchop Attack:
Enabled decryption without key recovery:
- Allowed decrypting any captured packet byte-by-byte
- Used CRC weakness to verify guessed plaintext bytes
- Approximately 128 packets per decrypted byte
- Combined with fragmentation, enabled packet injection
2007 — The PTW Attack (Pyshkin-Tews-Weinmann):
The current state-of-the-art in WEP cracking:
- Uses all captured packets, not just weak IVs
- Requires only ~40,000-85,000 packets
- Key recovery in under 60 seconds on modern hardware
- Works against all WEP implementations
| Attack | Year | Packets Required | Time to Crack |
|---|---|---|---|
| FMS | 2001 | 4-6 million | Several hours |
| KoreK | 2004 | 500K-1M | 10-30 minutes |
| PTW | 2007 | 40K-85K | < 60 seconds |
| PTW + ARP Replay | 2007+ | ~20K | < 30 seconds |
With active traffic injection (ARP replay), attackers can crack any WEP key in under a minute using free tools like aircrack-ng, regardless of key length. The 104-bit 'high security' WEP is no more resistant than 40-bit WEP.
Cryptographic Lessons from WEP's Failure
WEP's failure provides essential lessons that directly influenced the design of WPA, WPA2, and modern cryptographic protocols:
Lesson 1: Never Reuse Keystreams
Stream cipher security absolutely depends on unique key+nonce combinations. WEP's 24-bit IV guaranteed reuse. Modern protocols use 48-bit or larger nonces with strict sequencing requirements.
Lesson 2: Use Cryptographic MAC, Not CRC
Integrity protection requires keyed cryptographic operations like HMAC or authenticated encryption (AES-CCM, AES-GCM). CRC and other checksums provide no security against malicious modification.
Lesson 3: Don't Mix IV and Key Directly
Concatenating public and secret values violated RC4's assumptions. Modern protocols use key derivation functions (KDFs) that cryptographically mix inputs before use.
- •Large nonce space — Modern protocols use 48+ bit nonces with guaranteed uniqueness
- •Key derivation — Session keys derived through proper KDFs, not concatenation
- •Authenticated encryption — Encryption and integrity bound cryptographically (AEAD modes)
- •Per-packet keys — Each packet can use a derived per-packet key to limit exposure
- •Mutual authentication — Both parties verify identity before key exchange
- •Key rotation — Protocol supports periodic key refresh without disruption
Every WEP weakness maps directly to a WPA2 feature. WPA2's CCMP mode uses AES for encryption, CBC-MAC for integrity, 48-bit packet numbers, per-session key derivation via 4-way handshake, and proper nonce construction. The engineering learned from WEP's failure shaped a decade of wireless security.
KEEP LEARNING
Keep learning for free.
Read the complete lesson, save your notes and pick up where you left off with a free account. No card needed.