Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2881606pxj; Mon, 31 May 2021 13:32:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzMFCZZqnrz+Y0yOm7Xc62W02He69HT0ugPLzIfPcfePu5V16ehxRmXwb2tUlK7e4zXFcO X-Received: by 2002:a17:906:6bd8:: with SMTP id t24mr17726773ejs.501.1622493138711; Mon, 31 May 2021 13:32:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622493138; cv=none; d=google.com; s=arc-20160816; b=Sx1DzuxMKPlAJNts34COSjsyglkT9Rm0XE2Fj+XTk2iz0QWFokNFpTE4CX9t3c6axU /KNIgOrIEwtJfLvHeoKpwKdGoQll60+nwvLXAzwDO634+PGXKPF8n+9rsAweovl7aoBb aD7UjNDCquQ8hGU3Rrhu3NLZSMEKU1115RLQ9da+2MvzyoaDZGYuQ2IzTzUnkvbkTmYE UMQ68diPr6mLhn7Rnr3kibEROkLvLOUKjw92f4r86PIOcxtBP8x41JgTBsO78+nQEO7f s1B1VXoKSlcS/BgB7BYyv86iKmhela1YMI4FCPczcAs1YV6UEBI8Pnibr2ZLlSIOtbZL X7eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ZNg8JKz/Orq1xzrlyH/9Ol6UEt8BQSh2mqfcpgJ8opc=; b=rtJIgWGFh2K+wbijXJzciIx3w+l9KcQD9BoGYfwi92SBpGtpyt66gFbFDj5uAocuon TS9d+Qgq04VB//7CVUZmL+GbZJbgO9RhEGggVEAQLA/gQ9SPkj+zWtx8essQ+Impxlp+ NFIPbRBzOPkeG2W5bkCNPHHQLGSbIOaAnZiu7d+nTIhY2MYMwoQuzDGr6GFMdX5Au2Dv zu1pbg4cQy323aECsY36h5m1tAuGWRfPhLpKzWTozcHEdqUXWGMRxoqjPPJLWof8oB+4 i3hza6AvLYMQtQQbs9uWCHZgBBBIdtW+UnmSxrYM32S/I2NsV9Bc28a+jssGUysXENmg 4UHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bt8si14231668ejb.153.2021.05.31.13.31.56; Mon, 31 May 2021 13:32:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232365AbhEaUdD (ORCPT + 99 others); Mon, 31 May 2021 16:33:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232186AbhEaUcs (ORCPT ); Mon, 31 May 2021 16:32:48 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7DCEC061761; Mon, 31 May 2021 13:30:31 -0700 (PDT) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) (envelope-from ) id 1lnoYP-000F87-Th; Mon, 31 May 2021 22:30:30 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: stable@vger.kernel.org, Mathy Vanhoef Subject: [PATCH v4.9 04/10] cfg80211: mitigate A-MSDU aggregation attacks Date: Mon, 31 May 2021 22:30:15 +0200 Message-Id: <20210531203021.180010-5-johannes@sipsolutions.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531203021.180010-1-johannes@sipsolutions.net> References: <20210531203021.180010-1-johannes@sipsolutions.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Mathy Vanhoef 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 Link: https://lore.kernel.org/r/20210511200110.25d93176ddaf.I9e265b597f2cd23eb44573f35b625947b386a9de@changeid Signed-off-by: Johannes Berg --- 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