skip to content

Why does a WPA2-Personal client with a mistyped passphrase associate successfully and then fail, with the access point logging an invalid MIC on message 2?

level: seniorimportance: should knowfreq 26%

answer

  1. association never checks the secret
  2. first frame that depends on the PMK
  3. different PMK, different KCK
  4. no message 3 ever comes
  5. retries end in reason 15

basics

~20 s

Association never tests the passphrase. The first frame that depends on it is message 2: the client's wrong PMK yields a wrong KCK, so its MIC fails at the AP, which discards it, retries message 1 and finally deauthenticates.

solid answer

~40 s

Open-system authentication and association check capabilities, not secrets, so they succeed. Message 1 carries only the `ANonce` and no MIC, so the client cannot notice anything yet. The client derives its PMK from the wrong passphrase, hence a different PTK and KCK, and its message 2 MIC is computed with that wrong KCK. The AP derives the PTK from the correct PMK, the MIC does not match, and hostapd logs `invalid MIC in msg 2/4 of 4-Way Handshake` and drops the frame. No message 3 is sent; the AP resends message 1 until `wpa_pairwise_update_count` is exhausted, then deauthenticates with reason code 15, and wpa_supplicant reports that the pre-shared key may be incorrect.

go deeper

for a junior

Recall that association succeeding says nothing about the passphrase; the check happens later, in the four-way handshake.

for a middle

Explain why message 2 is the first frame that depends on the PMK, and why a wrong passphrase therefore surfaces as a MIC mismatch.

for a senior

Diagnose from evidence: a message 2 MIC failure means mismatched keys, while reason 15 without one points at the radio link or the client.

for a principal

Treat repeated MIC failures across many clients as a signal about how the shared secret is distributed and changed, not as individual help-desk tickets.

## The symptom A new colleague sees a laptop that shows the SSID, appears to connect for a moment, then drops and never gets an address. The AP's log shows a MIC failure on message 2 of the four-way handshake. The puzzle is why association worked at all if the passphrase was wrong. The answer is that nothing before the four-way handshake ever looks at the passphrase. ## Where the passphrase is actually checked A numbered trace of the exchange, with a mistyped passphrase on the client: 1. **STA -> AP, AP -> STA: open-system authentication.** Two frames, accepted; they prove nothing about keys. 2. **STA -> AP, AP -> STA: association request and response.** The AP checks capabilities, rates and the RSN element, and answers with status 0 (success). No secret is involved. 3. **AP -> STA: message 1.** It carries the `ANonce` and a replay counter, and no MIC, because no PTK exists yet. The client has nothing to check. 4. **STA: key derivation.** The client derives its PMK from the wrong passphrase, so its PTK, and the **KCK** in it, differ from the AP's. 5. **STA -> AP: message 2.** It carries the `SNonce` and a MIC computed with the client's wrong KCK. 6. **AP: verification.** The AP derives the PTK from its own, correct PMK and both nonces, recomputes the MIC and gets a different value. hostapd logs `invalid MIC in msg 2/4 of 4-Way Handshake` and discards the frame. **No message 3 is sent.** 7. **AP -> STA: message 1 again.** When its timer expires, the AP restarts at message 1 with a new replay counter, up to `wpa_pairwise_update_count` times (hostapd's default is 4). 8. **AP -> STA: deauthentication.** When the retries run out, the AP deauthenticates the client with **reason code 15**, 4-way handshake timeout. ## Why message 2, and not earlier or later - **Not earlier:** association does not involve the PMK, and message 1 has no MIC, so it gives the client nothing to test the passphrase against. - **Exactly at message 2:** it is the first frame whose content depends on the PMK, through the KCK that keys its MIC. - **Not later:** the AP never sends message 3, so the client never sees the AP's MIC and cannot itself prove that the keys disagree. It can only infer it from where the exchange stopped. The passphrase is never sent and never compared directly; the mismatch shows up only as two different MICs. ## What each side records | Where | What you see | |---|---| | hostapd debug log | `invalid MIC in msg 2/4 of 4-Way Handshake` for the client's MAC address | | hostapd control interface | `AP-STA-POSSIBLE-PSK-MISMATCH` followed by the client's MAC address | | Deauthentication frame | Reason code 15, 4-way handshake timeout | | wpa_supplicant on the client | `WPA: 4-Way Handshake failed - pre-shared key may be incorrect`, reported as `WRONG_KEY` | ## Telling it apart from look-alikes - **Message 2 never arrives.** The AP also gives up with reason code 15, but logs no MIC failure. That points at radio conditions, the driver or the client, not the passphrase. - **Association refused.** A non-zero status code in the association response is a different failure, earlier in the join sequence, covered with scanning and association. - **RSN element mismatch.** hostapd logs that the element in message 2 did not match the association request: a negotiation problem, not a wrong passphrase. - **Renamed SSID with a hex PSK.** A device configured with the 64-hex-digit PSK keeps the old value after a rename; because the SSID is the PBKDF2 salt, the AP's PMK changed and the symptom is the same MIC failure. - **Per-device PSKs.** With hostapd's `wpa_psk_file`, the AP tries each PSK configured for that client against the MIC; the failure means none of them matched. ## The fix Re-enter the passphrase on the client, or push the correct PSK through device management, then confirm that the next attempt reaches message 4. If several clients fail at once after a change, check whether the passphrase or the SSID changed on the AP side.

  • Why doesn't the access point simply tell the client that its passphrase is wrong?
    The four-way handshake defines no failure message for a bad MIC. A frame that fails its integrity check is discarded, because nothing in it can be trusted, so the AP just waits, resends message 1 and finally deauthenticates with reason code 15. The client side, such as wpa_supplicant, infers a probable wrong key from where the exchange stopped.
  • How do you confirm it is the passphrase rather than the radio link before touching the client?
    Look for the message 2 MIC failure in the AP's log. If message 2 arrived and failed its MIC, the radio link carried it and the keys disagree. If message 2 never arrived and the AP gave up with reason code 15 anyway, look at signal, retries and the client's driver instead.

  • If the passphrase were wrong, the access point would refuse the association.
  • The access point compares the passphrase the client sent with its own copy.
  • The client can detect a wrong passphrase as soon as message 1 arrives.
  • Reason code 15 always means the passphrase is wrong.
  • The access point sends message 3 with an error code when the MIC fails.