mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/do_not_allow_unauthenticated_encrypted_key_data_release_v4.1' into 'release/v4.1'
esp_wifi: Ignore unauthenticated encrypted EAPOL-Key data and fix See merge request espressif/esp-idf!18319
This commit is contained in:
commit
3d88183b23
@ -673,6 +673,16 @@ int wpa_cipher_put_suites(u8 *pos, int ciphers)
|
||||
return num_suites;
|
||||
}
|
||||
|
||||
unsigned int wpa_mic_len(int akmp)
|
||||
{
|
||||
/* The following code is supposed to be used for 192 bit encryption support only
|
||||
if (akmp == WPA_KEY_MGMT_IEEE8021X_SUITE_B_192)
|
||||
return 24;
|
||||
*/
|
||||
|
||||
return 16;
|
||||
}
|
||||
|
||||
#endif // ESP_SUPPLICANT
|
||||
|
||||
|
||||
|
@ -335,4 +335,6 @@ int wpa_parse_wpa_ie_wpa(const u8 *wpa_ie, size_t wpa_ie_len,
|
||||
|
||||
int rsn_cipher_put_suites(u8 *pos, int ciphers);
|
||||
|
||||
unsigned int wpa_mic_len(int akmp);
|
||||
|
||||
#endif /* WPA_COMMON_H */
|
||||
|
@ -1170,7 +1170,7 @@ int ieee80211w_set_keys(struct wpa_sm *sm,
|
||||
|
||||
os_bzero(null_rsc, WPA_KEY_RSC_LEN);
|
||||
|
||||
if (sm->proto == WPA_PROTO_RSN) {
|
||||
if (sm->proto == WPA_PROTO_RSN && isptk) {
|
||||
key_rsc = null_rsc;
|
||||
} else {
|
||||
key_rsc = key->key_rsc;
|
||||
@ -1772,6 +1772,9 @@ int wpa_sm_rx_eapol(u8 *src_addr, u8 *buf, u32 len)
|
||||
u16 key_info, ver;
|
||||
u8 *tmp;
|
||||
int ret = -1;
|
||||
size_t mic_len;
|
||||
|
||||
mic_len = wpa_mic_len(sm->key_mgmt);
|
||||
|
||||
if (len < sizeof(*hdr) + sizeof(*key)) {
|
||||
#ifdef DEBUG_PRINT
|
||||
@ -1928,7 +1931,18 @@ int wpa_sm_rx_eapol(u8 *src_addr, u8 *buf, u32 len)
|
||||
extra_len = WPA_GET_BE16(key->key_data_length);
|
||||
|
||||
if (sm->proto == WPA_PROTO_RSN &&
|
||||
(key_info & WPA_KEY_INFO_ENCR_KEY_DATA)) {
|
||||
(key_info & WPA_KEY_INFO_ENCR_KEY_DATA) && mic_len) {
|
||||
/*
|
||||
* Only decrypt the Key Data field if the frame's authenticity
|
||||
* was verified. When using AES-SIV (FILS), the MIC flag is not
|
||||
* set, so this check should only be performed if mic_len != 0
|
||||
* which is the case in this code branch.
|
||||
*/
|
||||
if (!(key_info & WPA_KEY_INFO_MIC)) {
|
||||
wpa_printf(MSG_WARNING,
|
||||
"WPA: Ignore EAPOL-Key with encrypted but unauthenticated data");
|
||||
goto out;
|
||||
}
|
||||
if (wpa_supplicant_decrypt_key_data(sm, key, ver))
|
||||
goto out;
|
||||
extra_len = WPA_GET_BE16(key->key_data_length);
|
||||
|
Loading…
Reference in New Issue
Block a user