Message ID | 20231001081046.GA14551@linux-691t |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp764493vqb; Sun, 1 Oct 2023 01:22:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCthQgvtdE7cI5+Ji/Z8KPVu640uHngr5HqQ/QajwQBHqqVhZXBjXqnb2GYTYEyyz8s1Av X-Received: by 2002:a05:6871:60d:b0:1d6:790e:dacc with SMTP id w13-20020a056871060d00b001d6790edaccmr10300003oan.6.1696148531987; Sun, 01 Oct 2023 01:22:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696148531; cv=pass; d=google.com; s=arc-20160816; b=LnLvnHOiFevbfyoIt4TpppmXt0+Xp6teKmUdRI1Lv7lMtJrCgIunbwQRfvFY/rMQsf IHWCF+IY5PkTBFHt3d+W4mYyVDrt9TtPLtOjwfkQZkgVsfHIDOQKl3hTbH3pHoALhFl8 5j8gf1qU6C039ACldHfhCq4y6qAVYxQN8HVkN59I0B+Q3+b70PTAMaTnWdWMVqGz4LfM WZm1BVYn2/MNXh4g3zasLUegikqy/H+lU9ddQE5Ecjgy/vYKAC9NiZQRXN5kiAuNFJjm 6JvMk2KZ0LUxo9WrUfjFznzoE/9UKzBUE3iKar2YA/O6olfxGGt4GtLXXJ9t/KyE2tbY 88gQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:in-reply-to :content-disposition:references:message-id:subject:cc:to:from:date :dkim-signature; bh=eGQqYZ0FgUqrYy37FVP0MiI7B5zDK0F712BQATH/yqA=; fh=YoKn3rNui1Uy12poG2FqwVn8fhiNCgV4MVj74J55Nj8=; b=ESj+C7VnYoRAipXpnSPqte3gDOpByu0/LXCyxLw7Quro8rYB2aI5j9L/pxiw37Q+BH ItJD4l/UB/ed9YUNjYaIhx4O2ULvYQ59AzAjdZ5xnevWa1oai/WTjexSqX0ljL1ucjUW XY7pmK0Sxorerp9lxScQQxq2YC7CizBjsrgw7SZVUeS/425PTV6gqqsR2smif+RGPF6p Swxf/9WZIaWuOgHbGHc641cb2xXyIvgnry0AQsPKvRc1lhO/c+DCLXrWlRreM9SsJiYM 1OyuDR0f7B4FhzqQQi5fTjKNNzk0g7mFj1OzVmdW/AcMcFctOeNB+dfEAbSxmoOy7b5L NjGw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b="v1/vfP37"; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id s123-20020a632c81000000b00573f76b1f75si24535587pgs.592.2023.10.01.01.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 01:22:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b="v1/vfP37"; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5F120802C65C; Sun, 1 Oct 2023 01:11:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234454AbjJAILE (ORCPT <rfc822;chrisfriedt@gmail.com> + 19 others); Sun, 1 Oct 2023 04:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234402AbjJAILD (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 1 Oct 2023 04:11:03 -0400 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2087.outbound.protection.outlook.com [40.107.13.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 472CCC2; Sun, 1 Oct 2023 01:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S81wK+Amgy0lDsjbrczVCT3kZJ8izBPYkNxr5oHfhuVxFKM2NI2rnOvTjk51PGc6r9et3f4zpQ0V6pC9yRH/OpDq6sIlhil8xg1m4CCgWy3rKR/SZq7PQHtJGRHVPAiIcw+mqsOe3r/xNpKVfSjbTdpbs1EnNK4auy/0oN2KwaCZgz/im3pHq542+EcYCJvuQWSjEN0UydX4Zk8UPFPtF7x8XHtfHkAWmfNLA0NxqMwQulMmd7c8KrmcV8vgjdnNWmFqRrsXo2tRdn0MK9RuS51SqQlURxCjia66zyTDSA93SiyesgdT7PCrxu1pRh3ZiJFEea5O2MWH2fA0p/nFcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eGQqYZ0FgUqrYy37FVP0MiI7B5zDK0F712BQATH/yqA=; b=JyAFQRjPaG2g+1drq5Nys6GiKw115sI2AP5d4EtIwSB3CHdQz7yIgPabz0wDERqCnAgv/E3YBBqNrNkI48yuaEDLh6JWfUtYfes1YkgQ/2cvbxxIPpgVn0h8DYa01xuaZGBL0KEpkunDQmrNWsW6otU3ZrMa+HpUVzjNaVBD35b0qpJa8aRMcsO0CiRJxznx0k4R56bMDXROi+lce6MU82RjbpYIRJIk6P9+yg0y47oZTc4MFKmFqZMMZschLavXLyHjYMTVYcVnQZFVoe9O8rkJnEM2XJc86Eejv9Ve0/Vy1Vl51lmrpUdVA4BNluiW/eurnEMdviD8cpLoESPUlA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eGQqYZ0FgUqrYy37FVP0MiI7B5zDK0F712BQATH/yqA=; b=v1/vfP377zE0SJNeY61iL6URa82notbdIm72akwYdIOKBGKf8+fwZyvxy9XzNl/HrMoK62w4buen4G0XwTTms5ct5pKp2UmXh4uMJ2yeNNFhUOgrCrLf9jisqfxvb1K8/vQdTuE1Rq2bMQGEZvX33S35y60v0UWRh0CHLpv9Ov8alKjE5K2m1XqCeBQWF0y7jQON0WEJ4/21HmhDrOTi4Df+B9VqS8iPnNyVmpss88qcn6dIPAhEY6J0MJMJUM++JKxMcGD03JC+D3xjv+uL8BN5uPqhJ0UMVG+ngdoH60DlrzFPQrUCE9NJ1laC70xHII8MiAHziHfm5TdBDJws+Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from DB8PR04MB7164.eurprd04.prod.outlook.com (2603:10a6:10:129::23) by AM9PR04MB8572.eurprd04.prod.outlook.com (2603:10a6:20b:437::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.23; Sun, 1 Oct 2023 08:10:57 +0000 Received: from DB8PR04MB7164.eurprd04.prod.outlook.com ([fe80::8647:4673:b19:acc2]) by DB8PR04MB7164.eurprd04.prod.outlook.com ([fe80::8647:4673:b19:acc2%4]) with mapi id 15.20.6813.027; Sun, 1 Oct 2023 08:10:57 +0000 Date: Sun, 1 Oct 2023 16:10:46 +0800 From: "Lee, Chun-Yi" <jlee@suse.com> To: Marcel Holtmann <marcel@holtmann.org>, Johan Hedberg <johan.hedberg@gmail.com>, Luiz Augusto von Dentz <luiz.dentz@gmail.com> Cc: linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org Subject: [PATCH 1/2] Bluetooth: hci_event: Ignore NULL link key Message-ID: <20231001081046.GA14551@linux-691t> References: <20231001080328.GA14494@linux-691t> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231001080328.GA14494@linux-691t> User-Agent: Mutt/1.11.4 (2019-03-13) X-ClientProxiedBy: TYCP286CA0157.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:383::12) To DB8PR04MB7164.eurprd04.prod.outlook.com (2603:10a6:10:129::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8PR04MB7164:EE_|AM9PR04MB8572:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b646b5b-a635-4e29-9baf-08dbc255f127 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YwDHG8n2HLFuH74X7q1bdHwnPQHfrCB16E/gh1pvLYjbWnDtHqpzmS8xx/CIqrEOjTmO0c7DrlWQIgcTudbbL4IxIfjRkxJGk3C7dcvccC2g4JxdzyLOFNHkMKg2cOoGyKx4SItnapbxxUQNpK6Bjq9RHDwV299wCeQJlbXZLVYSZTz9GIMpk/x0ankPPX2XzkHxIV9V4TjmSF/6ObZsy9og7By9ksLOFex1PzhczEjJaVVXoXU7cqGXB2nkvu+8txAcqeWzkRM3dIH4+mDapPhsEo4CCv0R21mD1oQV0p0tQGSzUgElChJTh2Ky+rJY8DbOBpbtCN3EnK3yo5ToomMzBfovgT5DmO3TE+B8AmwJVEjqqYSKf89yPQ1zvfqY7nGFa/IK+MQ1UDFGgQzZivIusjjrA16AoEFJY8ZUIPndQPqgcyqqVnjGuSvO/WBe7EUFems0vRYh5QYiNZ6dg0x57E4FYzRScmFEeLkd1XzT6uditCEWrK0MsrroNEdMvyUc+DmiFEayAU+B9FoakaT2DJrdRCA9nu8FcJZ1bxI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB8PR04MB7164.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7916004)(376002)(346002)(39860400002)(136003)(396003)(366004)(230922051799003)(1800799009)(186009)(451199024)(64100799003)(1076003)(26005)(33716001)(38100700002)(86362001)(33656002)(83380400001)(316002)(8936002)(8676002)(4326008)(5660300002)(41300700001)(110136005)(66476007)(66556008)(66946007)(2906002)(6506007)(6666004)(6512007)(9686003)(6486002)(966005)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zEMj0mD50TTEnaJySBBmqPou5dH7eNIYeO1VcLSkIkpR7HFzetpziBMP8OsZW7JsLwpylWmy6Zeawf+4Uestp/7sW8wcLwFS1l/S9T2ihLT9Zv1RKOuqSlvn+PA4BkRc0jRTpqlqEEktzMbIr/61WNXsGqpkUS8YNKbk6ZqXSGd6kINBZPtDEonTE9aUzcrDIn5CvsPzRIHXrc9AFcey+4MM18mdvsvM07wVbW+iGjLjg1c+OiUSDsazCS2HXKdvD1pujLOQqRYUOFdxlm6ADuuhKJ37yiCvv/UTQ2cgANzXSnrS3K6Z8B7CGu6LVFb4ryUDJL9TO3ot5cn9OhofELd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r+f/hwZmw9UHt+1m2RBmObJDWVDWeSnMMfS648JP5bTFW2+eBz3J73mtFdYKvmm2d/CVKMdll/6oAzUYcwpOzlX9LiJLYaqqKfcIl7A+HtBIv8JMWyfZMbsesoqb9aPbDm4uocgzOTgqtcuWQ/WlZj37KXryNejHxWcaMMUmsgOU// X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b646b5b-a635-4e29-9baf-08dbc255f127 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB7164.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2023 08:10:57.7861 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MdnDpaJKBBTeqAgC0Lj0ONTyLnmY6kwo/y4sjTQcuvYAFvi9BrSLXZLG0zEI9Isx X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8572 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 01 Oct 2023 01:11:26 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778540642832451597 X-GMAIL-MSGID: 1778540642832451597 |
Series |
Bluetooth: ignore NULL link key and reject connection with the device which has same BD_ADDR
|
|
Commit Message
Lee, Chun-Yi
Oct. 1, 2023, 8:10 a.m. UTC
This change is used to relieve CVE-2020-26555. The description of the
CVE:
Bluetooth legacy BR/EDR PIN code pairing in Bluetooth Core Specification
1.0B through 5.2 may permit an unauthenticated nearby device to spoof
the BD_ADDR of the peer device to complete pairing without knowledge
of the PIN. [1]
The detail of this attack is in IEEE paper:
BlueMirror: Reflections on Bluetooth Pairing and Provisioning Protocols
[2]
It's a reflection attack. The paper mentioned that attacker can induce
the attacked target to generate null link key (zero key) without PIN
code. In BR/EDR, the key generation is actually handled in the controller
which is below HCI.
Thus, we can ignore null link key in the handler of "Link Key Notification
event" to relieve the attack. A similar implementation also shows in
btstack project. [3]
v3: Drop the connection when null link key be detected.
v2:
- Used Link: tag instead of Closes:
- Used bt_dev_dbg instead of BT_DBG
- Added Fixes: tag
Fixes: 55ed8ca10f35 ("Bluetooth: Implement link key handling for the management interface")
Link: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-26555 [1]
Link: https://ieeexplore.ieee.org/abstract/document/9474325/authors#authors [2]
Link: https://github.com/bluekitchen/btstack/blob/master/src/hci.c#L3722 [3]
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
---
net/bluetooth/hci_event.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 95816a938cea..a20a94e85b1a 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -4692,6 +4692,14 @@ static void hci_link_key_notify_evt(struct hci_dev *hdev, void *data, if (!conn) goto unlock; + /* Ignore NULL link key against CVE-2020-26555 */ + if (!memcmp(ev->link_key, ZERO_KEY, HCI_LINK_KEY_SIZE)) { + bt_dev_dbg(hdev, "Ignore NULL link key (ZERO KEY) for %pMR", &ev->bdaddr); + hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE); + hci_conn_drop(conn); + goto unlock; + } + hci_conn_hold(conn); conn->disc_timeout = HCI_DISCONN_TIMEOUT; hci_conn_drop(conn);