summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathy Vanhoef <Mathy.Vanhoef@kuleuven.be>2021-05-31 22:28:28 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-06-03 08:22:05 +0200
commitdaea7ff51861cec93ff7f561095d9048b673b51f (patch)
treed44f42489caaaabf438a28ab7dcd8a0d0ff76559
parente76511a6fbb5e568a2db4da8da5a120481c914fe (diff)
cfg80211: mitigate A-MSDU aggregation attacks
commit 2b8a1fee3488c602aca8bea004a087e60806a5cf upstream. Mitigate A-MSDU injection attacks (CVE-2020-24588) by detecting if the destination address of a subframe equals an RFC1042 (i.e., LLC/SNAP) header, and if so dropping the complete A-MSDU frame. This mitigates known attacks, although new (unknown) aggregation-based attacks may remain possible. This defense works because in A-MSDU aggregation injection attacks, a normal encrypted Wi-Fi frame is turned into an A-MSDU frame. This means the first 6 bytes of the first A-MSDU subframe correspond to an RFC1042 header. In other words, the destination MAC address of the first A-MSDU subframe contains the start of an RFC1042 header during an aggregation attack. We can detect this and thereby prevent this specific attack. For details, see Section 7.2 of "Fragment and Forge: Breaking Wi-Fi Through Frame Aggregation and Fragmentation". Note that for kernel 4.9 and above this patch depends on "mac80211: properly handle A-MSDUs that start with a rfc1042 header". Otherwise this patch has no impact and attacks will remain possible. Cc: stable@vger.kernel.org Signed-off-by: Mathy Vanhoef <Mathy.Vanhoef@kuleuven.be> Link: https://lore.kernel.org/r/20210511200110.25d93176ddaf.I9e265b597f2cd23eb44573f35b625947b386a9de@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/wireless/util.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 0c7b9de1e7f1..915f1fa881e4 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -689,6 +689,9 @@ void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
/* the last MSDU has no padding */
if (subframe_len > remaining)
goto purge;
+ /* mitigate A-MSDU aggregation injection attacks */
+ if (ether_addr_equal(eth->h_dest, rfc1042_header))
+ goto purge;
skb_pull(skb, sizeof(struct ethhdr));
/* reuse skb for the last subframe */