From nobody Wed Jan 7 03:30:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43C34E748ED for ; Sun, 1 Oct 2023 08:08:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234470AbjJAIIc (ORCPT ); Sun, 1 Oct 2023 04:08:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234416AbjJAIIb (ORCPT ); Sun, 1 Oct 2023 04:08:31 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2053.outbound.protection.outlook.com [40.107.15.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA092C2; Sun, 1 Oct 2023 01:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iKV9qVxFUq5OP59rT828HD6quGBNyGecP039OQFUdna0/U2uzBFxscM07/vXxvoCoJFNg5D2RPQSFAYq0zm5bjtqhACVrYus/OsUvsxkh2DzouzM6H++nCZ8nWhkFLfTVnovuNSTCm2iMfgHzJ+6ys2PPoCKFaISs1/7B+NA4v1s7/bBrPLjaQKv1j4i+iUUOX47F/S/18kcUb87vNNWq0l0eLNdECl1UDrgaI8zfV2w0AY5EuTdgPT66xWuOY4r0t7mEPPUiz5oJpJBjuBwoZgQze6DcA0Wa/ZSe0ry3NAtnmKlvvwE3ZK2ccqcrRX0nnA2r6zhWS+sm7/EeW+icw== 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=h9QzRe2mCOV2pgPirFCRYtJdZ5iuAPZRTSDRZeZvBKGE+IC5cqDdEhziTrBzJPRXWkqf+WfuqH4SO5t6MNklKxghRaXtldb4xtbpSZgpiGzNLbrfXl790saY0PgtPh1jTWCWuvsudF/cCuJetRfOrRLGRWsoF917R8gHYYWBmllop4csBMcRe2fporBzKX1tConGDtxmSTw/EX2BLjX1BhOgJFol2bJJ847wJMz+/7drJrul/Y7R2PCeGlo00KiECxhVXKxaVosRdaX7I4ZQuFWRrhsTc9MH/Ykt2y6HANxzJijWlb2UR/UzV3GoYCC6lETBO+YaBPUnPfpp7P/Lpw== 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=rRm74ao4AJBdQQ3CFJratCV6N7F/fDjb9oTd/3PEz2rnkZXFb0c4+KOUV7pheeQ4S6VRsLiNRAcOI+Sbs1jzNytzB8yqDKG1ip91NcN4ussRjWOQFug9lK2DeySGMj0RPM+5XxnF8tbgfzeUzmZedqoA4BgkU1gQKAE8fw9LNkM0X9vW2LkZ+ALlBN373pIR21gEKXRkni4u7mTHoBPeqBMEwD7Qx/naowkdlGUoAXXeVHbyJ4DrovXjvRRY1BnkfOuY8AMOdVLC3p7UxUDP4rfRm9XJrQXUhavuH4qKxRY2yo1vuDlNDYDngwfazsfyTpK1BYqlQGgbsh3+0eDpPw== 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:08:26 +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:08:26 +0000 Date: Sun, 1 Oct 2023 16:08:13 +0800 From: "Lee, Chun-Yi" To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org Subject: [PATCH 1/2] Bluetooth: hci_event: Ignore NULL link key Message-ID: <20231001080813.GA14514@linux-691t> References: <20231001074524.GA14361@linux-691t> Content-Disposition: inline In-Reply-To: <20231001074524.GA14361@linux-691t> User-Agent: Mutt/1.11.4 (2019-03-13) X-ClientProxiedBy: TYCP286CA0067.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:31a::9) 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: bc0a1c72-277d-453a-d8ee-08dbc25596a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NqcaeDvVwL6IKIWPnzzCIKlHikLBxaJ1w42i0z5PKBLaU1vbxmhzviFAEsldbvzWDk9otWwg3uQn2d/DdZjHCTEJ6POPjfgG+pWDZzSMphlYkObxjXj/OUSZUPDVc8XMPl9ShcNUQC2/aHgT1tkWPp8pM+LT7K68V4YGPszgQVJJwO2qaTbtKE9s0NIWljl0gaUsmVaM2IQvhj/ckJMrJwlcX1hGhEyO4O7F11j377IdfWFGs+arsfL9RiHbPakjpO31XiHULhNj25FXzL6Idjpr1nP3mplHfJzGxvuLJZNa950Nij5ocfsV7Ef5AfeoFyxxMq9ppSRh+d5149/NM7kYuUtBeSKCX4xcpXKXIkrR9EhhgaaTD6sAgQUJr2ThCuEys2qPjFXdyJ5vOwtFMfGzKEVN6N3hgVznC6Hf3S8DyU45odgQZOdnyDQhrXxaR88BCy4MiqtRA2sEWJ/Vd7yhUlI0PZlL/B09CVfcsLcbjKJCE2b/XyfLFr9xb7Bsn58hp1K1IUAvytnmx9sVRrz5jEHl0BEzMmTe1QM5tiM= 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: =?us-ascii?Q?sdKkf3oreHeWlVSI47uHsNOFlJuo50DVU394nB110u2pY132C4ifo3yQfmF4?= =?us-ascii?Q?FK+/841BzTYz3Rpkd1HHQA2beBy9heSq+bPUjS2lfivmLIyo1bymmbgiTt+S?= =?us-ascii?Q?I8oP9dT+xVQEp/hzjOcpvqZww//SC6Aiv3H/PYYSpxyAGWwn65U88gXd9DiN?= =?us-ascii?Q?BArq8n+7LvhLYFnPfF373l+H9uDs1peCVJWyH/z7PquSkZ2ea4vcNbfS8/uy?= =?us-ascii?Q?t5EfYJGhuxrtkvg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ii?Q?0lqlDAJXPsPAv7VEDskKf4Ce/sZeTiv7HQpWpBRqNpHI/8AvLZMMbFy9+2Gm?= =?us-ascii?Q?h+xH32sYnabFLKHfI1ZcO0hYIu64j/GGYBxMzvRrcnZ9YYMhhmiElRuBZ8vF?= =?us-ascii?Q?eQ6XZDF0nexZ1+8WgisZbPHnQR7FrZzVu3rbjFKAMk9WxIla+I8Eq+G7bmhe?= =?us-ascii?Q?N6AoOqx0znTi4DXewNY56TdEqnwicGzpaY0oqt1OPdpnxnCa4/8L3Ms0HIJt?= =?us-ascii?Q?J88XzZ2gm0WJ6TizgLLlr4cdAnwBNsBBKE7QKB3SA4HBH38dc1zqlWl3J7Hp?= =?us-ascii?Q?jqvtUoB8wM00FK8NCVxSszJzbDb0bRybympSmQ1umdDVksOOymvL27wjxejw?= =?us-ascii?Q?XnZ+60lenfQa3mCmbuVKg839h5R6IzGKnEsMQ61q2N1R95msPt6qyyeFHZxj?= =?us-ascii?Q?QKgXVkx6JEUrEtW9/9Ao1NjQIPrtS1ZCtw0KBhW1?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc0a1c72-277d-453a-d8ee-08dbc25596a7 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:08:25.9779 (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: z5sPcvSGjInDsrXO1GWWM5gBl3WJAnaAKe+t4EGZhsEycEl6hMb2sszGaWwgBzzI X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8572 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 manage= ment interface") Link: https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-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 --- 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; =20 + /* 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 =3D HCI_DISCONN_TIMEOUT; hci_conn_drop(conn); --=20 2.35.3 From nobody Wed Jan 7 03:30:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 441AAE748E9 for ; Sun, 1 Oct 2023 07:48:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234434AbjJAHsZ (ORCPT ); Sun, 1 Oct 2023 03:48:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234371AbjJAHsY (ORCPT ); Sun, 1 Oct 2023 03:48:24 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2040.outbound.protection.outlook.com [40.107.14.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 401C5C2; Sun, 1 Oct 2023 00:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aLB0t7zC/lq3iMg+c9TVDX9Ayl+IqmP0Se1vwHZIS7p1TiOPI4/HMHv2OWB571dOVWVVszuD/Eg+86scSQeWOBaO7rSOWD/A76JPfWiS5PKSsZbWDqUl/5O/Z6D0+/N0VihsUSoMYXfRWcW+/1Btr3HGDMFGZYr/pbPDjipo/iYDuwRP4ePyi1feQnzBs0ebmw/LYJ7AuK0ll+v1nrx1AGjfA9/lgR+xL8V2x7CP032r7CMljWd4uEkD2WLfzCWbP7XqwN5rwMgg2aV4dSI+cnETOwmM2RGykQ6n+aYLj+38Yngf3/v7fu3JD+iFRjvOhIbZ0wDvQ5fwmJYW62w9Uw== 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=L0MNFp2UntHJFx1dXGI+BT0ZJ6l0Ay9Gxz6P+d2eqlQ=; b=G4sWXEbxJjEN8+7wtibDI11Wf4KbUFlmCOThzYUshKM+I2hqnif2J5Q4jznu8VpTNl0HtSg+KL0HMUfUv/YWCeQIOKK5jYRRXpBJY9v5ucjVhi17JFFKbf3fOq3knrTR69EM1bAwerXqVUOnEyZgVp+xxd5A/t0za80reP/f8IdCQb4KOXpR6YGm6HpnB900x7TzacLMNH6HF8gPNWmmjeVc+uNehFz0eygpQ40QnjtCH8zxbchXfaV2upanvV7wLIBeEmYDrTpycjrxuHUYSFc7PwOvq2aEF57jPqG9vwdqJWIdPIF4oLol6oztZyQOCDPThU7Vy2Wa25HBMhg5dw== 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=L0MNFp2UntHJFx1dXGI+BT0ZJ6l0Ay9Gxz6P+d2eqlQ=; b=oz1V9/cvFEADADhJabXqwMwSl0qRWCveCmCt83Zf9Spu3+0OvbG8PIirLFo5u3RiQ1XIInoU2O2EOWuosMFTJ6CaOVZW3jUaCM3kqMbvzCI/e0YbL9GvAmPPxGripTwwdL4ko81Yzx5IDIYCt78rJtMja6hruaRTVo52Tq7ytOPyYUsNO4PC/P8YuEMiXFIWWiOExtsZwGi++4xGjx97ViNCKXSARrXkCnfGpxoSmFn0iTIv8LfOnDBPie6L7YIvujnROKqJsumtmGLUaM/9ZvlRDwbj8J9uRMNydicJbs8jp5AcYo1gdxlNYcbQqQVNVIljm9dG+pA+0XG7/TMtMw== 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 DBBPR04MB7531.eurprd04.prod.outlook.com (2603:10a6:10:20c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Sun, 1 Oct 2023 07:48:18 +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 07:48:18 +0000 Date: Sun, 1 Oct 2023 15:48:07 +0800 From: "Lee, Chun-Yi" To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org Subject: [PATCH 1/2] Bluetooth: hci_event: Ignore NULL link key Message-ID: <20231001074807.GA14403@linux-691t> References: <20231001074524.GA14361@linux-691t> Content-Disposition: inline In-Reply-To: <20231001074524.GA14361@linux-691t> User-Agent: Mutt/1.11.4 (2019-03-13) X-ClientProxiedBy: TYCP286CA0169.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c6::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_|DBBPR04MB7531:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b3fac63-3358-4cc8-fe11-08dbc252c715 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U9mXWXS8rrOCiAI2nuwCKmEidnmmNQMvYikNpS8GjteL1cFkIaWZbswbh3pN1UGhAig+3yiMSVf1bgZmy28XsrTzGUUyCAQD2UsM0m2dmxFPJ7nLIDKRCcGOajj4rk64L0oWFbIPaBEnE6Jp0L+qyuzpeV83CzvqSDKLIDUGsH4/nx1Du4kNCjkWnoKH/Z+IAhcs5cbAOHheMYxPQn1jLOansYWja1h5d8S7oVdbo9EJplp6vstEeeYlHSDYeHG6ORgrV/p4pNeXqvj+4BvK90uV860e7w6mGArnMLxUVhA8BEqisYVowJVrzn44s9BqfYGvQusJX2FF731/iINIXm3UKR8KT4/nZnFMNbLMjf1h7DJ0xharVZ114nliUonF0lD+edAj9G3fpEdOi+uCQPureV3rEvPU5ofM3G3QMJyTFQYt7j0b9C0Mm7HqvSiWH0bc0c0Dc2Gy+a8e87MBaVqfFvw0W0iofZXJXj3HlwStcYWOrPtLIRmuPoacjai+MoC3O7NdZeoYBZByQDyb4PcVJLBBOq0xz/o8BhXsecE= 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)(366004)(376002)(136003)(396003)(346002)(39860400002)(230922051799003)(64100799003)(451199024)(1800799009)(186009)(66556008)(66476007)(316002)(110136005)(5660300002)(66946007)(41300700001)(966005)(8676002)(38100700002)(83380400001)(478600001)(9686003)(33716001)(86362001)(2906002)(6512007)(33656002)(8936002)(4326008)(6506007)(6486002)(6666004)(1076003)(26005)(53546011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?k9opQ7n7Save4OoAPzWQnyApFFhun3zNwl62b4Za1q2sctL866oGXnLrbErK?= =?us-ascii?Q?SbD6fm79VJI9CPlKHdiQQEQnORKbEVR6mpW96QX9PUEWyU53JRJdRR8mm90p?= =?us-ascii?Q?qRA/yAehoiKFyxIsJ3ExPH0bFHaYnzJM8pFAUTkV/6mo6pDE78jKxjfVWWrY?= =?us-ascii?Q?tgeycwNkOtZCbFmob1mB3MyiCVUpNsca3stSXOpMnX88SjTBC+RAtB3QH5qi?= =?us-ascii?Q?lafbKQS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EfLLMvf8hPHy/FB9?= =?us-ascii?Q?JwsT3QrJF/kmGjyTDy+vZZtBGw986nW7n0DewkrJdfiw9xF43/IPUhxwwt97?= =?us-ascii?Q?QMg03ruV3npzbqk86nu6g0sRRkIUGTeoAL3Qj+adGBBhy+6t+NalaSuF2a4Q?= =?us-ascii?Q?en+u0vhGKRwNJinkDjEPpgsuOIUCaItOwCXraDR0cNDvN6HSvIeDXUJ80fEr?= =?us-ascii?Q?NZF/vquSt2bDkJsECM9funVJ5V54f7U5lZor0Syqc7Sv/eFFfL2U3k6A3bRi?= =?us-ascii?Q?AsQ3b4Ys0py19lL6w8eCF+0oBHr6DhmCm9XPc9fnlzl8/rm1gPHuk9gKZF4h?= =?us-ascii?Q?mCOmWlVV9ype4aahJElGwdlZGZb7S1YkfWXPhCntFBtCvz91LLoOByeVIQJ8?= =?us-ascii?Q?QjB/oIe6BFspsie7Mtn3V/FZvxeQRB/psOX6oYhRDbD/YeXTyVZt7vyFt1TP?= =?us-ascii?Q?dL6/kp2MlOpcUZ4IwBI=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b3fac63-3358-4cc8-fe11-08dbc252c715 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB7164.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2023 07:48:18.7234 (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: Syj0m95vYuCE59VtdhfIpFUGC2Fm4bdvRXYeY1T68DOQ2ArMjeMxc0p1zNeFuJq1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7531 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 manage= ment interface") Link: https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-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 --- 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; =20 + /* 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 =3D HCI_DISCONN_TIMEOUT; hci_conn_drop(conn); --=20 2.35.3 From 5fed42878147cffa22e695732d87a85c218d217f Mon Sep 17 00:00:00 2001 From: "Lee, Chun-Yi" Date: Fri, 14 Jul 2023 21:14:01 +0800 Subject: [PATCH 1/2] Bluetooth: hci_event: Ignore NULL link key In-Reply-To: <20231001074524.GA14361@linux-691t> References: <20231001074524.GA14361@linux-691t> 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 manage= ment interface") Link: https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-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 --- 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; =20 + /* 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 =3D HCI_DISCONN_TIMEOUT; hci_conn_drop(conn); --=20 2.35.3 From nobody Wed Jan 7 03:30:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6437EE748E9 for ; Sun, 1 Oct 2023 08:09:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234478AbjJAIJZ (ORCPT ); Sun, 1 Oct 2023 04:09:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234416AbjJAIJX (ORCPT ); Sun, 1 Oct 2023 04:09:23 -0400 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2043.outbound.protection.outlook.com [40.107.13.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EE78BA; Sun, 1 Oct 2023 01:09:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WDQAUiqKh3stLRv2s2q38oRIxodE/W2m6FeyW8dibnGU/Ark1SNce4vVCTMP9VcErqicHCSo88gpIlqw6QBHgGlow0dD4rIFJ3dDgKX5q4D6g/mv6vkCJLdM53SPn8IwCMjSrNcFA4ROs7jPAYHDlF9scKf7ojewdzilJMd6SW4qWh7RMj7kRzbUEs6UxXGTKwN844HxEc333ncSWioUPKGakW3icEd/bmGKPQea/BSDhQnyJsBxKvaaEtwNbPXOxEXz3HLP7KZ2+pT2hquNZh742skvEDULIy0oLJ9dZhPwHVVUeRNqMsBtXwYkBvNbt6MAaZe1w1aMLIhsOXV97g== 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=nbg5dEf2maQJUv1G4F/zAIXkuiIeUoM3JSyBo3VOpYw=; b=kgBR92n3NImhibBJCcR+OXpQqcpYSL6QxcyrPX2O8kVMKZGVgX4N9YbplGLpZIpZ9DQvZ51c8Nm9gp89Da/Svfq/WDHKiA0cT2uqqBQ4NUPrczrQHLlwNUhBdeY5Z66XgDGEbtyxsIn7IVBbbAJjtHOoAe2a66uXLqinU3R7aXzNA4MDowXzFuZ50vPZFvPte663Z+LleS5GVBHHQxQ1rhuICtK0BkrHxaCezZyfyu+jZ0X+5NNkQJZtGftsbMG/tx5koE2rkO1REwcxqoPxPuvtHhjkhDCNQi/6l9y1w0JteIfmAa57hXJ+OW1dBBFQYW98dY+aK3moNTHn/W3eMA== 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=nbg5dEf2maQJUv1G4F/zAIXkuiIeUoM3JSyBo3VOpYw=; b=mPhyn5rcY/sxFpuhqqscoHxS9V22kBkQrxg61dF4ICajqjK9r3iSioCosj5SdzdCwlrEpqEGRMG2rulXWykxReM1RWr3s4JEJVecJgE8QjUC6wdxUPjQXFe0sizBii/WUEaHwz8Wp/IWFAfHlJdnr0fevqonfH692BzMTRR9iFYwhcytEpbl6VJ7N03nqe54drvprNWbp6hvUsPJVE9LHTu4NVXZBGQDA65lYZ8D3x8I5M/noAnGGzFhbEJiUK99S+6OK5rm0netGb5YJr9KkRgD9HEHbPlrIvluSgDYXC0nW9XjKeqo7nW7hS/sI6/sSQHBVVVKWBqjG20rXUOrpw== 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:09:18 +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:09:18 +0000 Date: Sun, 1 Oct 2023 16:09:06 +0800 From: "Lee, Chun-Yi" To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org Subject: [PATCH 2/2] Bluetooth: Reject connection with the device which has same BD_ADDR Message-ID: <20231001080906.GA14521@linux-691t> References: <20231001074524.GA14361@linux-691t> Content-Disposition: inline In-Reply-To: <20231001074524.GA14361@linux-691t> User-Agent: Mutt/1.11.4 (2019-03-13) X-ClientProxiedBy: TYWP286CA0004.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:178::6) 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: 9c98bc4d-c0b0-4257-c168-08dbc255b5a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 01a9kkeOI2J9cNw6bs+2Hbj3yjunhom/z1qvcArpmW+hNEKMT6udte3GzRKMLmubyhjC93YStzkAGoVE0iAiKpOKAk2rGMNz0vs7wgMkEuyO3JMTmgSCzibFVQ0sbtWzB5unvQMEXHWndiJGCp0YGwbKQ/V/ldeleNtZcaZmqyrbHOFZOgdvFq7pL2tnve7XasZFcvUuO342ZIFsjA5fVBr6tO2Mb2d2sCDDLkOwZ/8M9Q0Nqmznq5TUOlZl/DvptAnrlec3iiv3dimjQtY/i7ZGUOKuo7uY9EfRc9aQyuTf2lP2Lzww6AQE0UvQXswsjxc9s5SO2MpV83bFM5ylB6ROjcMPAehOw1KAsUEPiRE9/oFl0jq7JCrN2HhDC71otdLRaGpDL/GOHQ0JYFEPgP137UZOJppP83GNYsu71c2b/cAWNlGgtlgW0hIREpgaq7ngjWZqlqNOrMPsW+OCU1Mjogn62IOjll5ZiJrz2ZSyhTkSIYegm4z3OJ93hrpellsqVvOfi8yKlAS3VHNN0W+4yBWd23WHxsfJNj4fGs0= 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: =?us-ascii?Q?stbhGU91R7VT0Gr+ErR0kKlziNBl+Vt/qBiCn4sGYXWc73H78wYbSv5S+U5R?= =?us-ascii?Q?aCHZg2riDvnzKbvaaHVvFmwCOgeZoE1EGBeBly2HZPbqM2k1hCD7PnnivEdd?= =?us-ascii?Q?aJtbolOemcLlhFUwBIpcAsw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?4VwXMAZnjQuZ3QCV8XsIbiHS9H32MAA7YxIzJDA+j6DdJDXGOoZcXyYwVP1T?= =?us-ascii?Q?oZXO+v1Nq6Xov0pIIbcsOA01RIfRnMtPAz3zjEJKRWyV5gAtBiuXA0umzZFw?= =?us-ascii?Q?B7sYuPjBxeytsBXKzGs/xDprTOplZGsVQqmiwE7wdiKZ4Xx8xaE1vR08bCiD?= =?us-ascii?Q?nUwwLaBB+a+OmPH+2UHh4KUl25O9npVm7AVWShRsM1NPqF8gf/a1QW9WLPPw?= =?us-ascii?Q?OVsZr7ZLjBRPl0S3l1YPomlhrjiFCg0RdIlJFQjrHZ50q1hYS65QLBEqHzGF?= =?us-ascii?Q?roEr0Tkn1c7Mf3WFT7x58uqWgrheYoh/3CpqjjZoit3HsHpF6r4w4gkcA+FK?= =?us-ascii?Q?cD0XUTvk0/X+0UP1NdJxtt1SpcCGmCqHcVonSbZ3FetdRE3g4vqIhnxARpSI?= =?us-ascii?Q?1APjCbHhpV0vEo2b6dNSOX+Zl5NPhYqCvsMQP8G7RrhBZFdzVhLSeKrfC72b?= =?us-ascii?Q?Clp+TaKRbboO3ssh1txGjoZwWRGI/VzENOte2xZhY7AIBLvoLMIWNg3YW2TD?= =?us-ascii?Q?rKaqANXVCz187oeSEQGI8ELGNAEsxJDDdV2pnA6V?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c98bc4d-c0b0-4257-c168-08dbc255b5a9 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:09:17.9857 (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: uQ5WE7B1PXcEfQVsEcZO6o1FoTXfAwlYiphY0ibzVJR73K3AkD4KaCb/zdSaS3mA X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8572 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. A condition of this attack is that attacker should change the BR_ADDR of his hacking device (Host B) to equal to the BR_ADDR with the target device being attacked (Host A). Thus, we reject the connection with device which has same BD_ADDR both on HCI_Create_Connection and HCI_Connection_Request to prevent the attack. A similar implementation also shows in btstack project. [3][4] Link: https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-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#L3523 [3] Link: https://github.com/bluekitchen/btstack/blob/master/src/hci.c#L7297 [4] Signed-off-by: Lee, Chun-Yi --- net/bluetooth/hci_conn.c | 7 +++++++ net/bluetooth/hci_event.c | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 056f9516e46d..583d2e18314e 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -1611,6 +1611,13 @@ struct hci_conn *hci_connect_acl(struct hci_dev *hde= v, bdaddr_t *dst, return ERR_PTR(-EOPNOTSUPP); } =20 + /* Reject outgoing connection to device with same BD ADDR against CVE-202= 0-26555 */ + if (!bacmp(&hdev->bdaddr, dst)) + { + bt_dev_dbg(hdev, "Reject connection to the device with same BD_ADDR %pMR= \n", dst); + return ERR_PTR(-ECONNREFUSED); + } + acl =3D hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); if (!acl) { acl =3D hci_conn_add(hdev, ACL_LINK, dst, HCI_ROLE_MASTER); diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index a20a94e85b1a..d66718190dc5 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -3268,6 +3268,14 @@ static void hci_conn_request_evt(struct hci_dev *hde= v, void *data, =20 bt_dev_dbg(hdev, "bdaddr %pMR type 0x%x", &ev->bdaddr, ev->link_type); =20 + /* Reject incoming connection from device with same BD ADDR against CVE-2= 020-26555 */ + if (!bacmp(&hdev->bdaddr, &ev->bdaddr)) + { + bt_dev_dbg(hdev, "Reject connection from the device with same BD_ADDR %p= MR\n", &ev->bdaddr); + hci_reject_conn(hdev, &ev->bdaddr); + return; + } + mask |=3D hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type, &flags); =20 --=20 2.35.3 From nobody Wed Jan 7 03:30:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BB6BE748EE for ; Sun, 1 Oct 2023 07:49:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234428AbjJAHtJ (ORCPT ); Sun, 1 Oct 2023 03:49:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232301AbjJAHtI (ORCPT ); Sun, 1 Oct 2023 03:49:08 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2087.outbound.protection.outlook.com [40.107.14.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56D7CC2; Sun, 1 Oct 2023 00:49:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X1htsTr/JmY8eys+NCs+ZCmyScDp3v8a1Itghg1QNBcOEhjxZs3vXOj6lvure9QkM6iQ8mqKOlPODtvffVxCHBvcj8GHwet/huqXR3zdKII79wUDhYEozSct7F0JBXeyuE4wrq1tLpRzn8y7iAC8HUWQUUyGAg90mXuGLmBvUEdFW71CGnM5BxfN5DfWRhbeLD1sLvoTCrk8sWe5+nM51y+BujM7FfOXaqbVgJLg2tgHKNBcf3C1SEfHYJhLMtbJPw/3zu6GMX+xA5y5wmYBUAyK7Z0q3cmI9Ixhdr15kEK1761ZWsWFDG713qL0w6c5Q0AJNg9rL3wJ9a5Oiw/xOQ== 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=yWlURxDKCHcs14XBgG4qxuP9buQKtvsoB0qHNoAYn64=; b=DTapKtqupm4yhRsomB5591pSLmVHLdDGpjFJ8ceJEgkzto2YeZKN9k6GpaKpzTKRdF+y3ibOxso3A6iUA7n+KOObDQ3hUluHLVAvIwGXYyffDvRRGOqJqaZrGt7lmkTcD/FvSqEk+Ibe82i4R98mwBDojPhf/0kLBxvQfVaQg7hjY9z+bnRcFrTzugguwrA+HKrkv08nMElpOqEHhAaYXO90rhiaA+brtAmYm6AEwcaBEFtaB53WNmoDGNe9E7XLGQbiwPpOoxU9YpNlVHQTrV/tzlCXOoVIBCO28rWWFrXHGlORmdYfHLUnQ9sWwBJN3F3JYbflSLT4DTyFuIOLLg== 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=yWlURxDKCHcs14XBgG4qxuP9buQKtvsoB0qHNoAYn64=; b=FwRH6FoITYRTRott1yOdXToiKI1UL5KrG2929xYn+AXux4R7ITbvfNp3dbxyTVZZ69QckV6viB6OGqAaJYpBYaydyALnhHSjYOn+2ml71OmvA5difrg05Z/xQyf6R89FXIIEQoVfPKJC1w6rJug35EYFRMOTctAqYK/XvX0Tt4Kv0XobIaQhLA1o6c1wbNsBY8UlGGuHqzRAyuNV6adcNaG0i+ioA4OlU8TqWHV6OhnJGt2CN4w38VCxfdp14cDvzFIPnSiwMStqQjDPl74plC0T7CGy2+EQ3L3g5enX4SSDvCxcvESqiGHjC1o67zmYU/9fD3Dr2nXup0jzTYUnDQ== 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 DBBPR04MB7531.eurprd04.prod.outlook.com (2603:10a6:10:20c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Sun, 1 Oct 2023 07:49:02 +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 07:49:02 +0000 Date: Sun, 1 Oct 2023 15:48:51 +0800 From: "Lee, Chun-Yi" To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org Subject: [PATCH 2/2] Bluetooth: Reject connection with the device which has same BD_ADDR Message-ID: <20231001074851.GA14412@linux-691t> References: <20231001074524.GA14361@linux-691t> Content-Disposition: inline In-Reply-To: <20231001074524.GA14361@linux-691t> User-Agent: Mutt/1.11.4 (2019-03-13) X-ClientProxiedBy: TY2PR02CA0050.apcprd02.prod.outlook.com (2603:1096:404:e2::14) To DB8PR04MB7164.eurprd04.prod.outlook.com (2603:10a6:10:129::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8PR04MB7164:EE_|DBBPR04MB7531:EE_ X-MS-Office365-Filtering-Correlation-Id: acc9f512-12ce-4746-e5f4-08dbc252e168 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Qzyitr6lER+nRLEf6gbU4MjNLEmJoEb5oDAVxRWKvXbtIIRlB2yug0CAA6qgbD4Evi5iwMW75WC7d/+tfHB7I6d/rdaycbyDDIsp5wVelaKXPxdRG3Pboin0S0imD0r6A+XKVuPW/1sz4D8fYSwwIuIBP/6RBNDVZG95iP+dB8yIf6HawX6Ki8zTKh3EQeUBuo7ltPwIthmElIaVFYIR5E4PGuuoSdYL5ZcC+Xp73DVAbBS5//LXvnvjYzxz42SYRhHbhOVPYKSyA+wUqzi7rn9liVhYl9iZKBiV8Ulapmd2eZM761ykLRmEUygD8OHX+BBk4Cx3H4eopgRZZSApliNJNAZs2JCJbPZiMJyf8Ois4eSiiiLOUylU3ws1yFmsBCizpztkHkHFTHnEF4kQ+zgZyrHLlV1qgho2H8UPkZ/rQk/IzdY5+b8dgaFxsTJuQa39vey5naxjvX1OjFy8fCBejRBXXH4D0j+jmZjxFvNMEEChT0TDofeCM4VZYy4L4mkGMbpwUPfE+/ebUKpaqI9F7KZLFBn7iWW7Sg3cruc= 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)(366004)(376002)(136003)(396003)(346002)(39860400002)(230922051799003)(64100799003)(451199024)(1800799009)(186009)(66556008)(66476007)(316002)(110136005)(5660300002)(66946007)(41300700001)(966005)(8676002)(38100700002)(83380400001)(478600001)(9686003)(33716001)(86362001)(2906002)(6512007)(33656002)(8936002)(4326008)(6506007)(6486002)(6666004)(1076003)(26005)(53546011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?XCDLeKRTwLtISQPSlYtse+Zq1lZvjR+ltTO1mszhjEsJwkUzIROFdbOUL9Sa?= =?us-ascii?Q?tGKjiL7gi+AbnN5SR8homMMzSJQ+oJq9DiP+qvDAINSIYUmKNP+sQ5qEv7cP?= =?us-ascii?Q?LrhOf7KtDSHuNICSLd1ALQvMHaZ2LT2AVZQjxiVDIKTVBPRxtMZxoWOxcxqv?= =?us-ascii?Q?yinFFbLjXv2oEu7oEvUgBIZz0AJl48UJ8fLSuf91QIcYZqxJDY3W6WLwOUY5?= =?us-ascii?Q?HNXBYAGRJBRhefwUYZRzAM5jgtZhW8AjZrmcKDHzKVuV9UwAu5HyiNqUQd7W?= =?us-ascii?Q?YelvAZ9yl8zXotvvfWuLtgbHYcVKCEGcPDBK8zOg7r5qb6MhPFanecF+RCEd?= =?us-ascii?Q?EljO3cYANTB4Rah277TjPgIwknEBXHHyR/BR/qjSfLHQ+so+/5L0lDaFAhra?= =?us-ascii?Q?IC9nQcG4TAbH5btirSVgANU+oZ04kGsZ9nR5WUPSm0FBBi82eAH5OdjemdLg?= =?us-ascii?Q?8pSYDWdkkPLiJsmsdxR4E9cuJK8/O+MERsQvI3uWsC/zCbVLMochQSVGc5bd?= =?us-ascii?Q?GceKlsN50xUpWvmlL9KiMQGshmpzf/7+9LyZ+RJV6eo/xJSw7zZDp8pdy8fZ?= =?us-ascii?Q?ZlD0qTwFkgTFi16kFcQOQTySrXJR8Y7zblA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IBJpABgschP5FBL45/lgPflf6CEjrhPAGKd5iEkFUYDxCWA6g4RuYEM?= =?us-ascii?Q?DW7RvmCjD38L9eOPujA=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: acc9f512-12ce-4746-e5f4-08dbc252e168 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB7164.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2023 07:49:02.9024 (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: MBPP9FHJ6M69dSGMKwcq2y1GSNu092zy1c/XitqPJJ1wlgLCHttvNc+fwEGR3zmD X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7531 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. A condition of this attack is that attacker should change the BR_ADDR of his hacking device (Host B) to equal to the BR_ADDR with the target device being attacked (Host A). Thus, we reject the connection with device which has same BD_ADDR both on HCI_Create_Connection and HCI_Connection_Request to prevent the attack. A similar implementation also shows in btstack project. [3][4] Link: https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-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#L3523 [3] Link: https://github.com/bluekitchen/btstack/blob/master/src/hci.c#L7297 [4] Signed-off-by: Lee, Chun-Yi --- net/bluetooth/hci_conn.c | 7 +++++++ net/bluetooth/hci_event.c | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 056f9516e46d..583d2e18314e 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -1611,6 +1611,13 @@ struct hci_conn *hci_connect_acl(struct hci_dev *hde= v, bdaddr_t *dst, return ERR_PTR(-EOPNOTSUPP); } =20 + /* Reject outgoing connection to device with same BD ADDR against CVE-202= 0-26555 */ + if (!bacmp(&hdev->bdaddr, dst)) + { + bt_dev_dbg(hdev, "Reject connection to the device with same BD_ADDR %pMR= \n", dst); + return ERR_PTR(-ECONNREFUSED); + } + acl =3D hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); if (!acl) { acl =3D hci_conn_add(hdev, ACL_LINK, dst, HCI_ROLE_MASTER); diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index a20a94e85b1a..d66718190dc5 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -3268,6 +3268,14 @@ static void hci_conn_request_evt(struct hci_dev *hde= v, void *data, =20 bt_dev_dbg(hdev, "bdaddr %pMR type 0x%x", &ev->bdaddr, ev->link_type); =20 + /* Reject incoming connection from device with same BD ADDR against CVE-2= 020-26555 */ + if (!bacmp(&hdev->bdaddr, &ev->bdaddr)) + { + bt_dev_dbg(hdev, "Reject connection from the device with same BD_ADDR %p= MR\n", &ev->bdaddr); + hci_reject_conn(hdev, &ev->bdaddr); + return; + } + mask |=3D hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type, &flags); =20 --=20 2.35.3 From 2c6cd3f353d21086a3163a9ad461789d203a7ee4 Mon Sep 17 00:00:00 2001 From: "Lee, Chun-Yi" Date: Wed, 16 Aug 2023 21:03:06 +0800 Subject: [PATCH 2/2] Bluetooth: Reject connection with the device which has same BD_ADDR In-Reply-To: <20231001074524.GA14361@linux-691t> References: <20231001074524.GA14361@linux-691t> 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. A condition of this attack is that attacker should change the BR_ADDR of his hacking device (Host B) to equal to the BR_ADDR with the target device being attacked (Host A). Thus, we reject the connection with device which has same BD_ADDR both on HCI_Create_Connection and HCI_Connection_Request to prevent the attack. A similar implementation also shows in btstack project. [3][4] Link: https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-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#L3523 [3] Link: https://github.com/bluekitchen/btstack/blob/master/src/hci.c#L7297 [4] Signed-off-by: Lee, Chun-Yi --- net/bluetooth/hci_conn.c | 7 +++++++ net/bluetooth/hci_event.c | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 056f9516e46d..583d2e18314e 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -1611,6 +1611,13 @@ struct hci_conn *hci_connect_acl(struct hci_dev *hde= v, bdaddr_t *dst, return ERR_PTR(-EOPNOTSUPP); } =20 + /* Reject outgoing connection to device with same BD ADDR against CVE-202= 0-26555 */ + if (!bacmp(&hdev->bdaddr, dst)) + { + bt_dev_dbg(hdev, "Reject connection to the device with same BD_ADDR %pMR= \n", dst); + return ERR_PTR(-ECONNREFUSED); + } + acl =3D hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); if (!acl) { acl =3D hci_conn_add(hdev, ACL_LINK, dst, HCI_ROLE_MASTER); diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index a20a94e85b1a..d66718190dc5 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -3268,6 +3268,14 @@ static void hci_conn_request_evt(struct hci_dev *hde= v, void *data, =20 bt_dev_dbg(hdev, "bdaddr %pMR type 0x%x", &ev->bdaddr, ev->link_type); =20 + /* Reject incoming connection from device with same BD ADDR against CVE-2= 020-26555 */ + if (!bacmp(&hdev->bdaddr, &ev->bdaddr)) + { + bt_dev_dbg(hdev, "Reject connection from the device with same BD_ADDR %p= MR\n", &ev->bdaddr); + hci_reject_conn(hdev, &ev->bdaddr); + return; + } + mask |=3D hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type, &flags); =20 --=20 2.35.3