FT: Answer a repeated FT Authentication Request with the same response
PATCH 1/1 FT: Answer a repeated FT Authentication Request with the same response
A STA that gets no FT Authentication Response in time sends its request again, as a new frame: mac80211 retransmits it 100 ms after the AP acknowledged it without answering. hostapd takes the repeat for a new
exchange: it draws a new ANonce, derives a new PTK and installs it. If the STA goes on with the response to its first request, its Reassociation Request carries the first ANonce while hostapd has the second, and hostapd refuses it with status 55 (Invalid FTE, ANonce mismatch). The STA gets on only after a new exchange.
An AP that is slow to answer makes this common. One such case is a STA that roams back to an AP that still has it as associated without PMF:
the response waits until hostapd has removed the STA from the driver and added it again. On OpenWrt APs about 5% of FT roams back to the AP a STA had just left were refused with status 55, after an Authentication frame retransmission, on FT-SAE and FT-EAP.
Reproduced with two FT-PSK BSSes on one ath10k radio and a mac80211 STA, with hostapd stopped for 400 ms as the STA started the roam: every roam where the STA retransmitted its request was refused with status 55 (5 of 5). With this change, 10 of 10 such roams completed, with one PTK installation each.
Keep the last FT Authentication Request and its successful response per STA, and answer an identical request with the same response, without deriving or installing anything. Forget them on any WPA state machine event except the FT reassociation that completes the exchange, so that a late copy of a completed request does not install a new PTK either.
---
Seen on OpenWrt APs (ath11k, mt76) running hostapd with FT-SAE and FT-EAP; reproduced and tested on an Arista W-118 (ath10k).
--- src/ap/wpa_auth.c | 9 +++++++++ src/ap/wpa_auth_ft.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- src/ap/wpa_auth_i.h | 3 +++ 3 files changed, 60 insertions(+), 1 deletion(-)
src/ap/wpa_auth.c +9 -0
@@ -1202,6 +1202,7 @@ static void wpa_free_sta_sm(struct wpa_state_machine *sm)#ifdef CONFIG_IEEE80211R_AP os_free (sm->assoc_resp_ftie);wpabuf_free (sm->ft_pending_req_ies); +wpa_ft_auth_forget (sm);#endif /* CONFIG_IEEE80211R_AP */ os_free (sm->last_rx_eapol_key);os_free (sm->wpa_ie);
@@ -2484,6 +2485,14 @@ int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event)wpa_auth_vlogger (sm->wpa_auth,wpa_auth_get_spa (sm),LOGGER_DEBUG ,"event %d notification" , event); +#ifdef CONFIG_IEEE80211R_AP +/* After anything but the reassociation that completes it, a later FT +* Authentication Request starts a new exchange. A late copy of the +* completed one still gets its response and changes nothing. */ +if (event !=WPA_ASSOC_FT ) +wpa_ft_auth_forget (sm); +#endif /* CONFIG_IEEE80211R_AP */ +switch (event) {case WPA_AUTH :#ifdef CONFIG_MESH
src/ap/wpa_auth_ft.c +48 -1
75 lines not on this page · raw message
src/ap/wpa_auth_i.h +3 -0
@@ -149,6 +149,8 @@ struct wpa_state_machine { const u8 *ies, size_t ies_len);void *ft_pending_cb_ctx;struct wpabuf *ft_pending_req_ies; +struct wpabuf *ft_auth_req;/* last FT Authentication Request */ +struct wpabuf *ft_auth_resp;/* and its successful response */ u8 ft_pending_pull_nonce[FT_RRB_NONCE_LEN ];u8 ft_pending_auth_transaction;u8 ft_pending_current_ap[ETH_ALEN ];
@@ -356,6 +358,7 @@ void wpa_auth_ft_store_keys(struct wpa_state_machine *sm, const u8 *pmk_r0,struct wpa_ft_pmk_cache *wpa_ft_pmk_cache_init (void );void wpa_ft_pmk_cache_deinit (struct wpa_ft_pmk_cache *cache);void wpa_ft_install_ptk (struct wpa_state_machine *sm,int retry); +void wpa_ft_auth_forget (struct wpa_state_machine *sm);int wpa_ft_store_pmk_fils (struct wpa_state_machine *sm,const u8 *pmk_r0,const u8 *pmk_r0_name);#endif /* CONFIG_IEEE80211R_AP */
---
base-commit: 1f2231a88a742befbea44bc19ffee94bed616505
change-id: 20261101-b95-ft-repeated-auth-0b27075cece4
Best regards,
Signature · 1 line
Christopher Griffin <[email protected]>