skip to content

In WPA2's four-way handshake, what does each of the four EAPOL-Key messages carry, and what does each one prove?

level: middleimportance: must knowfreq 40%

answer

  1. the authenticator speaks first
  2. nonce, then nonce plus MIC
  3. group key wrapped in message 3
  4. Install and Secure bits
  5. replay counter echoed back

basics

~20 s

Message 1 brings the AP's ANonce; message 2 the client's SNonce and a MIC proving it holds the PMK; message 3 the AP's MIC, RSN element and wrapped GTK with the order to install; message 4 confirms installation.

solid answer

~40 s

The access point is the authenticator and sends message 1 with its `ANonce` and no MIC, because no PTK exists yet. The client picks an `SNonce`, derives the PTK from the PMK, both nonces and both MAC addresses, and sends message 2 with the SNonce, its RSN element and a MIC keyed with the KCK, which proves it holds the PMK. The AP derives the same PTK, checks that MIC and the RSN element, and sends message 3 with its own MIC, its RSN element and the GTK encrypted with the KEK, with the Install bit set. Message 4 is the client's MIC-protected confirmation; then both install the keys and the 802.1X controlled port opens. Every message carries a replay counter so stale frames are dropped.

go deeper

for a junior

Recall the shape: four EAPOL-Key frames after association, the AP sends first, and the keys themselves are never transmitted.

for a middle

Walk through each message: who sends which nonce, where the first MIC appears, where the GTK travels and how it is protected.

for a senior

Explain the safety checks: the replay counter, the repeated RSN elements against downgrade in transit, and how retries end in a reason 15 deauthentication.

for a principal

Frame the handshake as the common back half of every RSN access model, so a change in how the PMK is produced leaves operations around it untouched.

## Who is who In WPA2 (the IEEE 802.11i security design), the access point plays the **authenticator** and the client the **supplicant**, terms borrowed from 802.1X. Before the handshake starts, both already hold the same **Pairwise Master Key (PMK)**: from the passphrase in Personal mode, or from the EAP exchange in Enterprise mode. The four-way handshake turns that long-lived PMK into fresh session keys, proves that both sides hold it, and delivers the group key. Until it finishes, the AP's 802.1X **controlled port** is closed and only EAPOL frames pass. ## The four messages | # | Direction | Carries | Key Information bits set | What it proves | |---|---|---|---|---| | 1 | AP -> client | `ANonce`, replay counter | Pairwise, Ack | Nothing yet: no PTK exists, so there is no MIC | | 2 | client -> AP | `SNonce`, client's RSN element, MIC | Pairwise, MIC | The client holds the PMK | | 3 | AP -> client | `ANonce` again, AP's RSN element, GTK (and IGTK when PMF is in use) wrapped with the KEK, Key RSC, MIC | Pairwise, Install, Ack, MIC, Secure, Encrypted Key Data | The AP holds the PMK; keys may now be installed | | 4 | client -> AP | MIC, no key data | Pairwise, MIC, Secure | The client has the keys and is ready | Read as a sequence: 1. The AP generates a random 32-octet **ANonce** and sends it. 2. The client generates its **SNonce**, derives the **PTK** from the PMK, both nonces and both MAC addresses, and replies with the SNonce, its RSN element and a **MIC** computed with the key confirmation key (KCK). 3. The AP derives the same PTK, verifies the MIC, compares the RSN element with the one in the association request, then sends message 3: its RSN element, the **GTK** encrypted with the key encryption key (KEK) using AES key wrap (RFC 3394), the starting sequence counter of that group key, and its MIC. 4. The client verifies that MIC, compares the AP's RSN element with what the beacon or probe response advertised, installs the pairwise and group keys, and sends message 4. The AP installs the pairwise temporal key when message 4 checks out. ## The fields that do the work - **Key Replay Counter** (8 octets): the AP raises it on every EAPOL-Key frame it sends, and the client copies it into its reply. The client drops any frame whose counter did not increase; the AP accepts a reply only when it carries the counter of a frame the AP actually sent. - **Key Nonce** (32 octets): the ANonce in messages 1 and 3, the SNonce in message 2. - **Key MIC**: for WPA2's PSK and 802.1X key management, HMAC-SHA1 truncated to 128 bits and keyed with the KCK, 16 octets. It is absent from message 1. - **Key RSC**: in message 3, the receive sequence counter of the group key, so the client knows where the GTK's packet numbers stand. - **Key Data**: the RSN element, and in message 3 the encrypted GTK (and IGTK) as key data encapsulations. ## Why the RSN elements are repeated The **RSN element** lists the ciphers and key-management suites a side supports. It first travels in beacons, probe responses and association frames without integrity protection, so the handshake repeats it under a MIC: the AP checks message 2's copy against the association request, and the client checks message 3's copy against the beacon or probe response. A mismatch aborts the handshake, which protects the security negotiation from being altered in transit. hostapd logs `WPA IE from (Re)AssocReq did not match with msg 2/4`; wpa_supplicant logs `IE in 3/4 msg does not match with IE in Beacon/ProbeResp`. ## Retries and failure - hostapd, the open-source reference implementation, retransmits messages 1 and 3 when no reply arrives; `wpa_pairwise_update_count` (default 4, the standard's `dot11RSNAConfigPairwiseUpdateCount`) sets how many times. - When the retries run out, the AP deauthenticates the client with **reason code 15**, 4-way handshake timeout. - After message 4, the same pairwise keys protect data until the client leaves or rekeys; later GTK changes use the two-message group key handshake, not a new four-way handshake.

  • Why does message 1 carry no MIC, and does that leave a gap?
    A MIC needs the KCK, and the KCK is part of a PTK that cannot exist until both nonces are known. If message 1 were altered in transit, the two sides would derive different PTKs and the MIC check on message 2 or 3 would fail, so the handshake fails safely rather than installing wrong keys. NIST's 802.11i guide makes the same point.
  • What does the Install bit in message 3 tell the client?
    It tells the supplicant that the authenticator is ready and the pairwise temporal key should now be installed for use. Together with the Secure bit, it marks message 3 as the point where keys go live; the client answers with message 4 so the AP knows it can install its own copy.
  • Does the handshake change after SAE or 802.1X authentication?
    No. The same four messages run in both cases; only the origin of the PMK differs. With 802.1X the PMK comes from the EAP method's key material, and with WPA3's SAE it is a fresh value from that exchange instead of a passphrase hash.

  • The access point sends the PTK to the client in message 3.
  • Message 1 is protected by a MIC like the other three.
  • The client generates the ANonce and the access point the SNonce.
  • The GTK is sent in clear text because every client needs it.
  • The handshake is complete after message 2 once the MIC checks out.