Lesson 3 of 13 · 14m
The WPA2 4-Way Handshake
PMK from PBKDF2, PTK from nonces, and why capturing just two EAPOL frames is enough for an offline crack.
WPA2 never transmits the passphrase. What travels are two 32-byte nonces and a MIC, and that is everything an attacker needs. The four EAPOL messages that constitute the handshake are the most captured frames in wireless.
From passphrase to PMK
The Pairwise Master Key is derived once, and deterministically:
PMK = PBKDF2-HMAC-SHA1(passphrase, ssid, iterations=4096, dkLen=32)The SSID is the salt. Two consequences fall out of that one line. First, the PMK never changes until the passphrase or SSID changes — no rotation, no freshness. Second, because the salt is the SSID, precomputed rainbow tables only work per-network-name; the old Church of WiFi tables covered the most common SSIDs, and any attacker can precompute password_candidates → PMK for linksys in bulk. But nothing stops a custom SSID from being attacked either — PBKDF2 with 4096 SHA-1 iterations is fast enough that a current GPU pushes on the order of a million candidates a second.
From PMK to PTK
The Pairwise Transient Key binds the PMK to this specific session:
PTK = PRF(PMK, "Pairwise key expansion",
min(MAC_AP,MAC_STA) || max(MAC_AP,MAC_STA) ||
min(ANonce,SNonce) || max(ANonce,SNonce))The PTK splits into three pieces: the KCK (computes MICs over handshake messages), the KEK (encrypts the group key in transit), and the TK — the temporal key that actually encrypts your data frames under AES-CCMP.
The four messages
- AP → STA: the ANonce, plus a replay counter. No MIC — the AP hasn't proven anything yet.
- STA → AP: the SNonce, the client's RSN IE, and a MIC computed with the KCK over the message body. This is the money frame: a valid MIC in message 2 proves the client holds the PMK.
- AP → STA: the GTK (group transient key, for broadcast/multicast) encrypted under KEK, an install bit, and the AP's MIC.
- STA → AP: an ACK. Keys are installed; data flows.
Why two frames suffice
An offline attack needs ANonce, SNonce, both MACs, and one valid MIC to check guesses against. Message 1 provides ANonce; message 2 provides everything else. The attacker doesn't need messages 3 and 4, doesn't need the GTK, doesn't need any data frames. Per guess: PBKDF2 the passphrase candidate into a PMK, expand into a PTK, take the KCK, compute the MIC for the captured message 2 body, compare bytes. Match means the password is found.
The hashcat mode for the standard workflow is -m 22000, the unified WPA-PBKDF2-PMKID+EAPOL format — it replaced the old 2500 (hccapx) and 16800 (PMKID) modes. hcxpcapngtool converts a pcapng capture straight into it.
The wrong mental model
People picture the password crossing the wire wrapped in crypto, and picture security as the strength of that wrapping. There is no password on the wire. There is a proof that can be tested against a billion guesses with zero interaction, zero rate limiting, and zero logging. The strength of WPA2-PSK is exactly the entropy of the passphrase — nothing else is in the loop.
What came before (and why it's evidence, not history)
WEP used RC4 with a 24-bit IV; Fluhrer, Mantin and Shamir's 2001 attack recovered keys from passive traffic, and by the PTW attack in 2007 aircrack needed tens of thousands of frames — minutes of capture. WPA-TKIP patched the integrity problem with the "Michael" MIC, which was itself so weak that Beck and Tews broke it in 2008. WPA2's AES-CCMP finally fixed the cipher layer. What none of this fixed was the passphrase-as-PMK architecture — and that is the part still being attacked.
What to do
- Length beats cleverness: 8 digits fall in ~100 seconds at a million guesses a second; 8 lowercase letters in days; a 16+ character random passphrase is out of practical reach.
- Non-default SSID for cosmetic privacy, but don't count on it — the attack isn't table-based anymore.
- If the password must be short for users to type, WPA2-PSK is the wrong algorithm. That's what WPA3 exists for.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
The Same Researcher Broke apt the Same Way Twice, Seven Years Apart
In 2019 Max Justicz showed apt would install a package an attacker swapped in over a redirect. In November 2026 he did it again, CVE-2026-109518, through a different door that ends in the same place: code as root from a man in the middle. The fix shows how apt reuses files on disk.
A 257-Byte Password Is the Key: Inside the OpenSSH musl Bypass
CVE-2026-123158 lets an attacker log into a locked account on musl-based systems like Alpine by sending a password nobody set. The trigger is one number, 257, and the reason is a C library returning a single asterisk. I reproduced the exact boundary against musl 1.2.4 and read the fix.
Zero-Trust Access for Homelabbers: Teleport vs. Tailscale vs. WireGuard vs. Cloudflare Tunnel
Four tools solve four different problems that all get pitched as the same problem. Here's what each one does, where each one breaks, and the combination that covers a real homelab without paying an SSO tax you didn't see coming.
Zero Trust Everything: The Complete Guide to Self-Hosting Teleport for Secure Infrastructure Access
SudoSecurity runs Teleport internally for everything — admin panel access, secure database connections, Kubernetes, and zero-trust philosophy across our entire team. This is the complete technical guide to installing, configuring, and running your own self-hosted Teleport cluster from scratch.