mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-04 04:54:18 +00:00
025bd93f36
From the patch series description: Several security issues in the 802.11 implementations were found by Mathy Vanhoef (New York University Abu Dhabi), who has published all the details at https://papers.mathyvanhoef.com/usenix2021.pdf Specifically, the following CVEs were assigned: * CVE-2020-24586 - Fragmentation cache not cleared on reconnection * CVE-2020-24587 - Reassembling fragments encrypted under different keys * CVE-2020-24588 - Accepting non-SPP A-MSDU frames, which leads to payload being parsed as an L2 frame under an A-MSDU bit toggling attack * CVE-2020-26139 - Forwarding EAPOL from unauthenticated sender * CVE-2020-26140 - Accepting plaintext data frames in protected networks * CVE-2020-26141 - Not verifying TKIP MIC of fragmented frames * CVE-2020-26142 - Processing fragmented frames as full frames * CVE-2020-26143 - Accepting fragmented plaintext frames in protected networks * CVE-2020-26144 - Always accepting unencrypted A-MSDU frames that start with RFC1042 header with EAPOL ethertype * CVE-2020-26145 - Accepting plaintext broadcast fragments as full frames * CVE-2020-26146 - Reassembling encrypted fragments with non-consecutive packet numbers * CVE-2020-26147 - Reassembling mixed encrypted/plaintext fragments In general, the scope of these attacks is that they may allow an attacker to * inject L2 frames that they can more or less control (depending on the vulnerability and attack method) into an otherwise protected network; * exfiltrate (some) network data under certain conditions, this is specific to the fragmentation issues. A subset of these issues is known to apply to the Linux IEEE 802.11 implementation (mac80211). Where it is affected, the attached patches fix the issues, even if not all of them reference the exact CVE IDs. In addition, driver and/or firmware updates may be necessary, as well as potentially more fixes to mac80211, depending on how drivers are using it. Specifically, for Intel devices, firmware needs to be updated to the most recently released versions (which was done without any reference to the security issues) to address some of the vulnerabilities. To have a single set of patches, I'm also including patches for the ath10k and ath11k drivers here. We currently don't have information about how other drivers are, if at all, affected. Signed-off-by: Felix Fietkau <nbd@nbd.name>
110 lines
3.1 KiB
Diff
110 lines
3.1 KiB
Diff
From: Johannes Berg <johannes.berg@intel.com>
|
|
Date: Tue, 11 May 2021 20:02:48 +0200
|
|
Subject: [PATCH] mac80211: check defrag PN against current frame
|
|
|
|
As pointed out by Mathy Vanhoef, we implement the RX PN check
|
|
on fragmented frames incorrectly - we check against the last
|
|
received PN prior to the new frame, rather than to the one in
|
|
this frame itself.
|
|
|
|
Prior patches addressed the security issue here, but in order
|
|
to be able to reason better about the code, fix it to really
|
|
compare against the current frame's PN, not the last stored
|
|
one.
|
|
|
|
Cc: stable@vger.kernel.org
|
|
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
|
|
---
|
|
|
|
--- a/net/mac80211/ieee80211_i.h
|
|
+++ b/net/mac80211/ieee80211_i.h
|
|
@@ -227,8 +227,15 @@ struct ieee80211_rx_data {
|
|
*/
|
|
int security_idx;
|
|
|
|
- u32 tkip_iv32;
|
|
- u16 tkip_iv16;
|
|
+ union {
|
|
+ struct {
|
|
+ u32 iv32;
|
|
+ u16 iv16;
|
|
+ } tkip;
|
|
+ struct {
|
|
+ u8 pn[IEEE80211_CCMP_PN_LEN];
|
|
+ } ccm_gcm;
|
|
+ };
|
|
};
|
|
|
|
struct ieee80211_csa_settings {
|
|
--- a/net/mac80211/rx.c
|
|
+++ b/net/mac80211/rx.c
|
|
@@ -2318,7 +2318,6 @@ ieee80211_rx_h_defragment(struct ieee802
|
|
if (entry->check_sequential_pn) {
|
|
int i;
|
|
u8 pn[IEEE80211_CCMP_PN_LEN], *rpn;
|
|
- int queue;
|
|
|
|
if (!requires_sequential_pn(rx, fc))
|
|
return RX_DROP_UNUSABLE;
|
|
@@ -2333,8 +2332,8 @@ ieee80211_rx_h_defragment(struct ieee802
|
|
if (pn[i])
|
|
break;
|
|
}
|
|
- queue = rx->security_idx;
|
|
- rpn = rx->key->u.ccmp.rx_pn[queue];
|
|
+
|
|
+ rpn = rx->ccm_gcm.pn;
|
|
if (memcmp(pn, rpn, IEEE80211_CCMP_PN_LEN))
|
|
return RX_DROP_UNUSABLE;
|
|
memcpy(entry->last_pn, pn, IEEE80211_CCMP_PN_LEN);
|
|
--- a/net/mac80211/wpa.c
|
|
+++ b/net/mac80211/wpa.c
|
|
@@ -3,6 +3,7 @@
|
|
* Copyright 2002-2004, Instant802 Networks, Inc.
|
|
* Copyright 2008, Jouni Malinen <j@w1.fi>
|
|
* Copyright (C) 2016-2017 Intel Deutschland GmbH
|
|
+ * Copyright (C) 2020-2021 Intel Corporation
|
|
*/
|
|
|
|
#include <linux/netdevice.h>
|
|
@@ -167,8 +168,8 @@ ieee80211_rx_h_michael_mic_verify(struct
|
|
|
|
update_iv:
|
|
/* update IV in key information to be able to detect replays */
|
|
- rx->key->u.tkip.rx[rx->security_idx].iv32 = rx->tkip_iv32;
|
|
- rx->key->u.tkip.rx[rx->security_idx].iv16 = rx->tkip_iv16;
|
|
+ rx->key->u.tkip.rx[rx->security_idx].iv32 = rx->tkip.iv32;
|
|
+ rx->key->u.tkip.rx[rx->security_idx].iv16 = rx->tkip.iv16;
|
|
|
|
return RX_CONTINUE;
|
|
|
|
@@ -294,8 +295,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
|
|
key, skb->data + hdrlen,
|
|
skb->len - hdrlen, rx->sta->sta.addr,
|
|
hdr->addr1, hwaccel, rx->security_idx,
|
|
- &rx->tkip_iv32,
|
|
- &rx->tkip_iv16);
|
|
+ &rx->tkip.iv32,
|
|
+ &rx->tkip.iv16);
|
|
if (res != TKIP_DECRYPT_OK)
|
|
return RX_DROP_UNUSABLE;
|
|
|
|
@@ -552,6 +553,8 @@ ieee80211_crypto_ccmp_decrypt(struct iee
|
|
}
|
|
|
|
memcpy(key->u.ccmp.rx_pn[queue], pn, IEEE80211_CCMP_PN_LEN);
|
|
+ if (unlikely(ieee80211_is_frag(hdr)))
|
|
+ memcpy(rx->ccm_gcm.pn, pn, IEEE80211_CCMP_PN_LEN);
|
|
}
|
|
|
|
/* Remove CCMP header and MIC */
|
|
@@ -782,6 +785,8 @@ ieee80211_crypto_gcmp_decrypt(struct iee
|
|
}
|
|
|
|
memcpy(key->u.gcmp.rx_pn[queue], pn, IEEE80211_GCMP_PN_LEN);
|
|
+ if (unlikely(ieee80211_is_frag(hdr)))
|
|
+ memcpy(rx->ccm_gcm.pn, pn, IEEE80211_CCMP_PN_LEN);
|
|
}
|
|
|
|
/* Remove GCMP header and MIC */
|