handshake: add support to work around buggy OWE APs
PATCH 1/2 handshake: add support to work around buggy OWE APs
The early OWE implementation for hostapd always used SHA256 to calculate the PTK, which violates the spec for group 20 and 21. This bug was in there long enough for the bug to make it into products and now it must be worked around here.
If the workaround flag is set, always use SHA256 to calculate the PTK.
--- src/handshake.c | 3 ++- src/handshake.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
src/handshake.c +2 -1
@@ -515,7 +515,8 @@ bool handshake_state_derive_ptk(struct handshake_state *s) s->ptk_complete = false;if (s->akm_suite &IE_RSN_AKM_SUITE_OWE ) { -if (s->pmk_len ==32 ) +/* Work around buggy APs which always use SHA256 for the PTK */ +if (s->pmk_len ==32 || s->retry_owe_workaround) type =L_CHECKSUM_SHA256 ;else if (s->pmk_len ==48 ) type =L_CHECKSUM_SHA384 ;
src/handshake.h +1 -0
@@ -137,6 +137,7 @@ struct handshake_state { bool authenticator_ocvc : 1; bool supplicant_ocvc : 1; bool ext_key_id_capable : 1; + bool retry_owe_workaround : 1;uint8_t ssid[32 ];size_t ssid_len;char *passphrase;
Signature · 1 line
2.34.3
PATCH 2/2 eapol: use OWE workaround after two ignored 2/4 messages
If the AP has rejected two 2/4 messages when using OWE assume its buggy and re-dervive the PTK in a way that it (hopefully) expects.
--- src/eapol.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
src/eapol.c +21 -0
@@ -1161,6 +1161,25 @@ static void eapol_handle_ptk_1_of_4(struct eapol_sm *sm,return ; } +/* +* Work around buggy OWE APs. Early hostapd implementations for OWE +* incorrectly used SHA256 for the PTK derivation even in groups 20 and +* 21 (should be SHA384/512). If we've already sent two 2/4 messages +* without a response and the AKM is OWE assume this workaround is +* needed and re-derive the PTK. +* +* TODO: This could be improved by checking if 2/4 was ACK'ed. If not +* this could just be a lost packet. +*/ +if (sm->frame_retry >=2 && + sm->handshake->akm_suite ==IE_RSN_AKM_SUITE_OWE && + !sm->handshake->retry_owe_workaround) { + sm->handshake->retry_owe_workaround = true; + +if (!handshake_state_derive_ptk (sm->handshake)) + goto error_unspecified; + } + pmkid =handshake_util_find_pmkid_kde (EAPOL_KEY_DATA (ek, sm->mic_len),EAPOL_KEY_DATA_LEN (ek, sm->mic_len));
@@ -1336,6 +1355,8 @@ static void eapol_handle_ptk_1_of_4(struct eapol_sm *sm,l_timeout_remove (sm->eapol_start_timeout); sm->eapol_start_timeout =NULL ; + sm->frame_retry++; +return ; error_unspecified:
Signature · 1 line
2.34.3