From patchwork Sun Oct 1 07:45:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lee, Chun-Yi" X-Patchwork-Id: 728378 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 A9302E748F3 for ; Sun, 1 Oct 2023 07:45:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234403AbjJAHpp (ORCPT ); Sun, 1 Oct 2023 03:45:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234392AbjJAHpo (ORCPT ); Sun, 1 Oct 2023 03:45:44 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2073.outbound.protection.outlook.com [40.107.14.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6FA0C6; Sun, 1 Oct 2023 00:45:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ry1b+7eSROGlSFEH1MkBb+XT3hWpciae50uu8g+drd+4GzhSxVHb7+1MIPqJ7HAaYPsDBNMWbIuxPVfwwwZmDrAbtVhWJOzs01HqlGhBHB9KosT6cxSjf91Of6EHxEfUdVfwGDK6iS1HZlK3bmalZ3j1sni6YXjnuFwxJytekLgo6XWGnD5d0nF3kIFm316+DpMblERVDFeoTafp4XJfMCAfbOv/tLe7PjBQunWO2rW58gYNL3sYkujE0Pb7Z6VNMRqTc5X2F4uGhl4XF4svZlSrjv8o/I0CBq7Zt08wyygPzJjREFUp0orN3H5+mEcseBlLLYxm2tU4SnK0nVmgqg== 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=mC00CyQjw2PbEiGh8IWOCl9Yhv+D+asdXu/1h7YCibI=; b=n59S9S+tfynoIKcgTp30x/lGHlfd5SFLlD4XqjlyUc1/NzVmRFQLHH6/RlO5amJ674H4EfC/7Osguik95/EkaJ7WiRH8XJp0K4cgAeCy4RGCD92YeIUDtcWktjCvdKOHxsFAcFt+ZbAHm/ETCIAcib8OojWZjOAsXyzzNf0MxourRfekwSD0fqJNVXXjQhla3JcoqNhK6DEk0jOHZ09RH4qFcNYFUlM/G1QS8HJ3sImm3lWrjEkKjPtvxr+ib86/7n/DiouWZy+eEgknuTMWwkwdSytvSwVf4lmbjgHio/HkcFiMHtNMiT3FmhPiCR7WQWgc7ZY6+HYO3WdIYAWJrA== 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=mC00CyQjw2PbEiGh8IWOCl9Yhv+D+asdXu/1h7YCibI=; b=pcgjatRkkqipGLvJTOxzWgDfkrxP8wrMzIf4ZSJF/dkUNaOEnOunNclYKOv7BilM8HGIpENuF2rw0nFbx2oJp5HzMCWtxfpSPiFtCA3Sxdohfu5Bh6mk4pfasPHvyi9BnVOuvcMPM9lNygETpwOGfMAK8+fY1cx7/UFsPiOId0/A00/v0uD6WzOW0MTfBxCjgSA3dwhPux1mVFFH+6LhbVPXKtOQC5CoMu3/8Ux/Lur3HLA6azJYkgGeZH74YY7G9AvVzwW+z0buR0op+TWV3GRXGnnhhkcludqIESuyDVMcVZO+TDmpCJ6NJWWBNDbReLcyJ5Uz8ahWPTfuse0nUw== 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:45:35 +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:45:35 +0000 Date: Sun, 1 Oct 2023 15:45:24 +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 0/2] Bluetooth: ignore NULL link key and reject connection Message-ID: <20231001074524.GA14361@linux-691t> Content-Disposition: inline User-Agent: Mutt/1.11.4 (2019-03-13) X-ClientProxiedBy: TYCP286CA0288.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c8::16) 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: 9e391341-a4a8-425e-c796-08dbc25265bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rEhZrE5LvmVZMqlL00TYQjqyXQ1uSOPw24o01yg7UxQvXUb/HjA8TQ9wjsAKom6aDDQY+BlUa0oCNpRt8hHpRSqO2fU9l0aWeuX4+8SHAZBP7xHZpo4kUXozb7NZ/kBK9+YOS0LErWFmj7oyZAmDHJaFxMiKFrXcK0TQDPh08j3zPrU2Px9/OSnfL0hgtp7LG5a02thkiDwqmdpDgdoEnEkSZ1RagT9lFwa/xpHGN8oQuVePv/ZRlSf04TqX8cgikDYc0Mmy4o6mcluMYE2FTVTQ0nisRecUFB9Klcm5E7+EAmD00cJUdH18sxxsoYqBqnSDQ9hWvs38lXKdCESgM7tLJzlywkgu/wnxuV9YDcrNW1B/F4jowQuP5heDiMYcgrteyL0JpRBHUH1VcJ5xNwlpEswiUCwmu6kuSUSBGANqV8Nptpxl5NWavo2Q6H6fbg/Pih/YeC/IZ3zvLOYH7l/jzfOK1B9vwpD3jB/snPFgcWbWJsNSrPeQoX2Yg5IIMPysR6XpgAJHqzl/eho4B9s8xmadMdO86CmtMV6ImXs= 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: eunEA6+T2v6pG/PKvrmHhpWCYa3dZho0vrrKLtNG1eAMQ9sC+Im8piKuEKraQGvbjoXWdNOAUqi8iaLbjNZlJ1swfZp4WtMhFuJy9tjGfLayTavcyl7Gzr3JqG7DFIVynxdaH1sJaLWJ7efkUCphn2Sg8n8bp6xCBTzHPVMWwZG5BqcYgsIpplrA1gPcibdAUW7PeTYGxXrqzJUNMQXcaEKJtsauIZX0opOheU7nr5bbSGKKzzQYOFu87G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MxIne/qxXTkm/oEMlAq0edy6qH9hi8MDDjCKK668Y14tuCkcglNwXBfF5DMd68YeH4q9vvvvM4DhDXUDMRepRj7mC8tLEPiIwgo5WQ1WFDgo6/TXyvEOM+KgVnpWb7HgC+acB9rDl3XMwZ7KuSFD9KCAI/YETA8z8jU9zV5pozuFToLC/aQ/mc2WccA8WC3BXOkGPvY2lBIDgnlfv5IV/Y/n2efDqDBSZFARk= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e391341-a4a8-425e-c796-08dbc25265bb 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:45:35.5192 (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: RRytNfEOuzwwB713SdoLdxF/D8F7B3mnckbUaZSCl00asfVXv6vizxtpIZnkVho3 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7531 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org with the device which has same BD_ADDR This patch set 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. And, 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). So we reject the connection with device which has same BD_ADDR both on HCI_Create_Connection and HCI_Connection_Request to prevent the attack. Similar implementations also show in btstack project. [3][4][5] 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] Link: https://github.com/bluekitchen/btstack/blob/master/src/hci.c#L3523 [4] Link: https://github.com/bluekitchen/btstack/blob/master/src/hci.c#L7297 [5] Lee, Chun-Yi (2): Bluetooth: hci_event: Ignore NULL link key Bluetooth: Reject connection with the device which has same BD_ADDR net/bluetooth/hci_conn.c | 7 +++++++ net/bluetooth/hci_event.c | 16 ++++++++++++++++ 2 files changed, 23 insertions(+)