From c3c38bc8b908f2719387acb65fabe805dd205587 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 1 May 2020 20:06:57 +0300 Subject: [PATCH] DPP2: Detect PFS downgrade attack while processing EAPOL-Key msg 3/4 Do not allow association to continue if the local configuration enables PFS and the station indicates it supports PFS, but PFS was not negotiated for the association. Signed-off-by: Jouni Malinen --- src/rsn_supp/wpa.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c index 22dd542f3..84ff1e1bd 100644 --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c @@ -1715,6 +1715,20 @@ static void wpa_supplicant_process_3_of_4(struct wpa_sm *sm, } #endif /* CONFIG_OCV */ +#ifdef CONFIG_DPP2 + if (ie.dpp_kde) { + wpa_printf(MSG_DEBUG, + "DPP: peer Protocol Version %u Flags 0x%x", + ie.dpp_kde[0], ie.dpp_kde[1]); + if (sm->key_mgmt == WPA_KEY_MGMT_DPP && sm->dpp_pfs != 2 && + (ie.dpp_kde[1] & DPP_KDE_PFS_ALLOWED) && !sm->dpp_z) { + wpa_printf(MSG_INFO, + "DPP: Peer indicated it supports PFS and local configuration allows this, but PFS was not negotiated for the association"); + goto failed; + } + } +#endif /* CONFIG_DPP2 */ + if (sm->use_ext_key_id && wpa_supplicant_install_ptk(sm, key, KEY_FLAG_RX)) goto failed;