0Pricing
Cryptology Academy · Lesson

RC4: Design, Weaknesses & WEP Attacks

Analyze RC4's KSA and PRGA and the biases that broke WEP/TLS.

RC4: Design, Weaknesses & WEP Attacks is a free Cryptology Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cryptology Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Welcome

RC4 was the most widely used stream cipher for 20 years — used in WEP, TLS, and SSL. Today it is completely broken. Understanding its failure teaches critical lessons about cryptographic design.

RC4 History

RC4 (Rivest Cipher 4) was designed by Ron Rivest in 1987 for RSA Security. It was kept as a trade secret until 1994 when it was reverse-engineered and published anonymously as 'Alleged RC4' (ARC4).

RC4 Key Scheduling (KSA)

KSA initializes a 256-byte state array S: 1. S[i] = i (for i = 0..255) 2. j = 0 3. For i = 0..255: j = (j + S[i] + key[i % keylen]) % 256; swap S[i], S[j]

RC4 Pseudorandom Generation (PRGA)

PRGA generates keystream bytes: i = j = 0 For each byte: i = (i+1) % 256 j = (j + S[i]) % 256 swap S[i], S[j] output S[(S[i]+S[j]) % 256]

Initial Byte Bias

The first bytes of RC4 output are strongly biased — not random. The first byte is twice as likely to be 0. Standard practice was to discard the first 1024 bytes, but many implementations didn't.

Fluhrer-Mantin-Shamir Attack (2001)

FMS showed that when RC4 key bytes are partially known (as in WEP where the IV is prepended to the key), statistical analysis of the keystream reveals key bytes. WEP cracked in minutes.

WEP Vulnerabilities

WEP used RC4 with: short 40-bit key + 24-bit IV prepended. The IV was too short (repeated every ~5000 packets) and the key+IV combination was fed directly to RC4 (triggering FMS biases).

WEP Cracking Demo

Tools like aircrack-ng could crack WEP keys by: 1. Capturing ~40,000 packets 2. Selecting packets with weak IVs 3. Applying FMS statistics 4. Recovering the 40-bit key in seconds WEP was deprecated in 2004, removed in 2012.

RC4 in TLS: NOMORE Attack (2015)

The Bar-Mitzvah attack and NOMORE attack showed RC4 biases could decrypt TLS cookies encrypted with RC4. Firefox and Chrome disabled RC4 in 2015. RFC 7465 prohibits RC4 in TLS.

RC4 vs Modern Stream Ciphers

RC4 weaknesses: - Biased output - No nonce support - State size limited to 2048 bits ChaCha20 fixes all of these with clean design, formal security proofs, and explicit nonce.

Never Use RC4

RC4 is prohibited in all modern standards. RFC 7465 (TLS), RFC 7435 (Opportunistic Security), PCI-DSS, and all major crypto libraries mark RC4 as deprecated or removed.

Quick Check

What fundamental weakness allowed the FMS attack to crack WEP?

Recap

RC4 is dead. Next we study its secure successor: ChaCha20 — designed with modern cryptographic principles.

Frequently asked questions

Is the “RC4: Design, Weaknesses & WEP Attacks” lesson free?

Yes — the full text of “RC4: Design, Weaknesses & WEP Attacks” is free to read here on the web, and the Cryptology Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cryptology Academy course, upgrade to CoddyKit PRO.

What will I learn in “RC4: Design, Weaknesses & WEP Attacks”?

Analyze RC4's KSA and PRGA and the biases that broke WEP/TLS. You practise Cryptology Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cryptology Academy?

No prior experience is required. Cryptology Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “RC4: Design, Weaknesses & WEP Attacks” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cryptology Academy lesson?

Yes. Every Cryptology Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Stream Cipher Concepts & PRNG
  2. RC4: Design, Weaknesses & WEP Attacks
  3. Salsa20 & ChaCha20 Design
  4. ChaCha20-Poly1305 AEAD in TLS 1.3
← Back to Cryptology Academy