Wonderful day!
Greetings, from Libera IRC! ^^
Just in case, no awful sorrowful LLM was used for this Gist.
Though, there's a lot of various articles about it, but sometimes it's better to recall it all manually, I believe.
The bellow chart is a 4-way handshake general representation I copied from a personal security paper I had prepared long ago for another project, with the dear four EAPOL-Key messages constituting the core of WPA2 network authentication, during which keys are generated and distributed between the client and the authentication system.
EAP over LAN (EAPoL or EAPOL) is an 802.1X-defined technique for encapsulating EAP or user data within LAN or WLAN networks.
Depending on the configuration, WPA2 and WPA3 networks can support various authentication systems, including 802.1X and the infamous Pre-Shared Key (PSK).
"Personal" networks are generally considered a simplified version of "Enterprise" networks, with the latter potentially involving diverse authentication methods—such as username/password combinations, certificates, or proprietary systems—supported by 802.1X (e.g., Robust Security Network (RSN)).
Here we focus primarily on an environment featuring a WPA2-Personal access point (AP) configuration that utilizes PSK authentication.
The Access Point (AP) - authenticator. The Station (client) - supplicant.
- The Access Point (AP) broadcasts a
Beacon frameto notify stations within range of its presence (each 100ms, usually). This frame contains critical AP information, including authentication mechanisms, supported capabilities, operational constraints; - The station transmits a
Probe Request frame(either directed to a specific AP or broadcast to all APs within range) to evaluate available network characteristics and select an optimal connection target; - Depending on the request type, one or more APs respond with a
Probe Response frame; - The station initiates an
OSA request(Open System Authentication) for the required AP; - The AP returns an
OSA response; - Ignoring or evaluating other network characteristics, the station sends an
Authentication Request framecontaining the AP's SSID and station parameters; - The AP validates the station parameters against its local configuration and transmits security parameter details in plaintext;
// EAPOL 4 messages (Start)
- [M1] The AP generates a pseudo-random
ANonceand transmits it to the station; - [M2] Possessing the dear lovely correct PSK, the station holds all variables required to derive the
PMKandPTK, calculatesMIC1, and transmits theframe counter(r) with the preciousSNonceto the AP; - [M3] Upon receiving
r,SNonce, andMIC1, the AP derives thePMKandPTK, verifiesMIC1, and (upon a successful match) validates the authentication payload. The AP then incrementsr, computesMIC2, and sends anM3 framecontaining the also preciousANonce, along with an AES-KEK encryptedGroup Temporal Key (GTK)if dynamic key management is supported; - [M4] If
GTKdistribution is supported, the station decrypts theGTK, computesMIC3, and sends thisM4 frameto acknowledge successful receipt of all security parameters;
// EAPOL 4 messages (End)
- [Authorized Data Transfer] Data frames between the station and the AP are encrypted using the derived keying "material";
- [Data Transfer] I.e., continuation as in Step 12;
- [Deauthentication (Client)] The client issues a
Deauthentication notification framefor the AP, marking the client state as unauthenticated and dropping subsequent encrypted data frames until a new session is established; - [Deauthentication (AP)] The AP sends
Deauthentication notification framesignaling that the authenticated session has terminated and re-association is required to resume data transfer.
We may see the monitored 802.11 traffic in Wireshark. For example, I've tried filtering the required frames matching the chart above:
As of 2026, if I am not mistaken, the WPA PSK is still primarily the result of the Password-Based Key Derivation Function 2 (PBKDF2), which incorporates a pseudorandom function (PRF) such as HMAC-SHA1.
In case of WPA2-Personal, the PMK is 256 bits from the following 4096 buts, computed offline beforehand via the following:
PMK = PBKDF2(
PSK, // Key
HMAC-SHA-1, // Hash type
SSID, // Data
4096 // Length
);In WPA2-Enterprise, it is derived within a whole 802.1X/EAP authentication.
Pairwise Transient Key (PTK) is a 512-bit key resulting from a KDF function applied to five concatenated key values:
// MAC_AP - MAC address of the AP
// MAC_STA - MAC address of the station (client)
Mac1 = Min(MAC_AP, MAC_STA);
Mac2 = Max(MAC_AP, MAC_STA);
Nonce1 = Min(ANonce, SNonce);
Nonce2 = Max(ANonce, SNonce);
PTK = PBKDF2(
PMK,
HMAC-SHA-1,
"Pairwise key expansion" + Mac1 + Mac2 + Nonce1 + Nonce2,
4096
);The "Pairwise key expansion" is a literal text, indeed.
The Pairwise Transient Key (PTK) is subsequently subdivided into the following five keys (128, 128, 128, 64, and 64 bits, respectively):
- [128] Key Confirmation Key (KCK) - Used to generate the
Message Integrity Code(MIC) for messages exchanged during the 4-Way Handshake and the Group Key handshake to verify frame authenticity and integrity. - [128] Key Encryption Key (KEK) - Used to encrypt and decrypt the
Group Temporal Key(GTK) transmitted within the mentioned above EAPOL M3. - [128] Temporal Key (TK) - Used to encrypt and decrypt payloads within 802.11 MAC Service Data Units (MSDUs) transmitted between the Supplicant and Authenticator.
- [64] Temporal Mic1 TX Key - Used to compute the MIC for unicast data frames transmitted by the Access Point (Authenticator).
- [64] Temporal Mic2 RX Key - Used to compute the MIC for unicast data frames transmitted by the Station (Supplicant).
The Group Temporal Key (GTK) is subsequently subdivided into the following three keys (128, 64, and 64 bits, respectively):
- [128] Group Temporal Encryption Key (GTE) - Used to encrypt and decrypt multicast and broadcast network traffic.
- [64] Temporal Mic1 TX Key - Used to compute the MIC for multicast and broadcast data frames transmitted by the Access Point (Authenticator).
- [64] Temporal Mic2 RX key - Currently unutilized, as WPA/WPA2 stations (Supplicants) do not transmit multicast or broadcast frames to the AP.
Tht is, the M1 and M2, or M3 and M2 is enough for the handshake, since they contain the precious nonces.
Therefore, if you monitor that dear IEEE 802.11 traffic and catch these EAPOL messages, with these precious nonces, knowing MAC addresses, you may now brute-force the PSK, since you have all the required for the PBKDF2 hash, including Mics to verify it.
![]() |
![]() |
| Visible DNS queries | Visible DNS and TCP |
|---|---|
![]() |
![]() |
At voila!
Here, please do upgrade to WPA3 to keep it more secure against a quite easy "Deauth" attack, where the frame mentioned in the chart's Step 15 (Deauthentication frame) is forged and injected in the 802.11 traffic as if broadcasted orignating from the AP.
Since, if station considers the session obsolete, it may initiate another EAPOL flow, and if monitored, reveal the whole handshake for that specific 802.11 session.
The 802.11 session mentioned is important, since if you have PSK, the Nonces are still required to decrypt the specific session between the client/supplicant and the AP.
You may find the fllowing interesting:
-
WPA PCAP cleaning to reduce the Packe capture (PCAP) size for the handshake only:
- https://github.com/aircrack-ng/aircrack-ng/blob/2f393aefda9c8f1b1f2486c14d43d5708fe625e9/src/wpaclean/wpaclean.c#L463
- May not work sometimes, from persona lexperience timming too much of valuable data, including EAPOL messages containing enough data for a brute-force. I would recommend to filter PCAP manually instead.
-
The infamous Matrix-like brute-force status:
-
The thread logic to calculate the PTK and verify it:
Please do stay safe!
- "You have to know the past to understand the present" ~ Carl Sagan
- https://exploitr.com/articles/understanding-wpa-wpa2-psk-cracking/
- https://en.wikipedia.org/wiki/Wardriving
- https://en.wikipedia.org/wiki/PBKDF2
- https://en.wikipedia.org/wiki/Open_Systems_Interconnection
- https://ieeexplore.ieee.org/document/654749 (802.11-1997 - IEEE Standard for Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) specifications...)
- https://www.m00nie.com/eap-eapol-and-eap-types/
- https://www.govinfo.gov/content/pkg/GOVPUB-C13-b8e12f91da751ff521dc4fb408e5c9af/pdf/GOVPUB-C13-b8e12f91da751ff521dc4fb408e5c9af.pdf (Guide to Securing Legacy IEEE 802.11 Wireless Networks...)
- https://www.cablefree.net/wireless-technology/history-of-wifi-technology/





