All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Cc: stable@vger.kernel.org, Mathy Vanhoef <Mathy.Vanhoef@kuleuven.be>
Subject: [PATCH v4.9 04/10] cfg80211: mitigate A-MSDU aggregation attacks
Date: Mon, 31 May 2021 22:30:15 +0200	[thread overview]
Message-ID: <20210531203021.180010-5-johannes@sipsolutions.net> (raw)
In-Reply-To: <20210531203021.180010-1-johannes@sipsolutions.net>

From: Mathy Vanhoef <Mathy.Vanhoef@kuleuven.be>

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>
---
 net/wireless/util.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/wireless/util.c b/net/wireless/util.c
index 8c67b7cf1def..939320571d71 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -769,6 +769,9 @@ void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
 		remaining = skb->len - offset;
 		if (subframe_len > remaining)
 			goto purge;
+		/* mitigate A-MSDU aggregation injection attacks */
+		if (ether_addr_equal(eth.h_dest, rfc1042_header))
+			goto purge;
 
 		offset += sizeof(struct ethhdr);
 		last = remaining <= subframe_len + padding;
-- 
2.31.1


  parent reply	other threads:[~2021-05-31 20:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31 20:30 [PATCH v4.9 00/10] wireless security fixes backports Johannes Berg
2021-05-31 20:30 ` [PATCH v4.9 01/10] mac80211: assure all fragments are encrypted Johannes Berg
2021-05-31 20:30 ` [PATCH v4.9 02/10] mac80211: prevent mixed key and fragment cache attacks Johannes Berg
2021-05-31 20:30 ` [PATCH v4.9 03/10] mac80211: properly handle A-MSDUs that start with an RFC 1042 header Johannes Berg
2021-05-31 20:30 ` Johannes Berg [this message]
2021-05-31 20:30 ` [PATCH v4.9 05/10] mac80211: drop A-MSDUs on old ciphers Johannes Berg
2021-05-31 20:30 ` [PATCH v4.9 06/10] mac80211: add fragment cache to sta_info Johannes Berg
2021-05-31 20:30 ` [PATCH v4.9 07/10] mac80211: check defrag PN against current frame Johannes Berg
2021-05-31 20:30 ` [PATCH v4.9 08/10] mac80211: prevent attacks on TKIP/WEP as well Johannes Berg
2021-05-31 20:30 ` [PATCH v4.9 09/10] mac80211: do not accept/forward invalid EAPOL frames Johannes Berg
2021-05-31 20:30 ` [PATCH v4.9 10/10] mac80211: extend protection against mixed key and fragment cache attacks Johannes Berg
2021-06-01  8:10 ` [PATCH v4.9 00/10] wireless security fixes backports Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210531203021.180010-5-johannes@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=Mathy.Vanhoef@kuleuven.be \
    --cc=linux-wireless@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.