Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2698677pxj; Mon, 31 May 2021 08:31:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpE/vvQ2SRV9NtniMzX66VAypjjkYzhYpwNdzYj6PGofpjUGnoRmPIVc25Oh6DPBb9xPK6 X-Received: by 2002:aa7:cd77:: with SMTP id ca23mr25942826edb.378.1622475114969; Mon, 31 May 2021 08:31:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622475114; cv=none; d=google.com; s=arc-20160816; b=CQTd/mq0OkxX5aTteRpyrtst/HiNW/l4ktWxDx2CQeUk8xSNmfwbBUIp/Hq8mD4avD zjt7qupoc1lBECTPxFwn77aKywUd/6UVXG2W2Etqtfu1wsqUV9k69yso359Q6c1xZusj 9j5VDLEdSnsOmsmdi8CE1CsBpSREKRnbpy+PuFkSkStRwM/XKBrRkAJ/th1YGfHpcOe3 0YZdubvaPA7urwPd/Eszm2r5Ok55If8aQFmYAXWWuq0/t1Rkf7ee1FTExVaQeFJqN7CQ 2BXbCMLn6910lf+MLq8C0L6ypsXnRR+6/RmcmHYEOi4yaCJNSutz3g/Zl7kFEheB8Bjv EdCw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y/gaISA37cQH5YxOT0RRBFA1/55yV4ESHjYzp++V0VQ=; b=xV55hL2i6YKCDyrQTUUtDJasGSk5IpwxYQuIdd9njdM1uG6wBPfiH8QKgXpF+FheJZ 55rir74FDs31VqeQriwWU/+jF1c6qjMAKjUtadwbKO8QUl2oOwGHtPaLJnYhNP3gkKGM MCNjQyVRUsZifKSBsdlB4HCVTjuzSUFgg20sBMeOUT3XSk333IsL92YpnQkLhtM4kAwH gRuKracluMaAPzcXWBr9oLfizwG0MUN6eSQPKBKqiytVluCOo19rRQKWWO0g9/skC3DU PDgeqeKhHxzaLDpkC/cGU7A8kFioU1yxY1B2gJBGoSg/jsLEdk85vrzz82roYYNzCU+q QuFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="sQ/Zr6Ke"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hp35si4566871ejc.227.2021.05.31.08.31.31; Mon, 31 May 2021 08:31:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="sQ/Zr6Ke"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234633AbhEaP0L (ORCPT + 99 others); Mon, 31 May 2021 11:26:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:43914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232171AbhEaOQp (ORCPT ); Mon, 31 May 2021 10:16:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D2D37619AB; Mon, 31 May 2021 13:43:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468598; bh=hqjHEKA1VFp8vfRcd3TJbg14kJYkSHRd9WCLyH65Z3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sQ/Zr6Ke1hyIGqnDs0iqPMm5TjqbaOnZrH7SW3GU+Er0dtbg1NG31G5b738dIxV8l Py+RaqwYkZZqEX3Rid2v7uKeZd4og8A1Frmn4bmNXLHZkc8M89qwuPTzfC+axmVILo DSIIS3T1xGpk4GgM/LjWydoLqEL8aMfIQUmJDX9s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathy Vanhoef , Johannes Berg Subject: [PATCH 5.4 017/177] cfg80211: mitigate A-MSDU aggregation attacks Date: Mon, 31 May 2021 15:12:54 +0200 Message-Id: <20210531130648.512596218@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130647.887605866@linuxfoundation.org> References: <20210531130647.887605866@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 Signed-off-by: Greg Kroah-Hartman --- net/wireless/util.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -681,6 +681,9 @@ void ieee80211_amsdu_to_8023s(struct sk_ 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;