From patchwork Sun Oct 1 08:49:34 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: 14786 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp973913vqb; Sun, 1 Oct 2023 10:12:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGW/mx5w0Fuos8NWd9NEq9iNT7FUTo4Iov4YSqChgNTDfWeegwS//RSWvDNzQ7yYE6yMo0W X-Received: by 2002:a05:6e02:1bc7:b0:34f:e02a:f820 with SMTP id x7-20020a056e021bc700b0034fe02af820mr13087606ilv.12.1696180363559; Sun, 01 Oct 2023 10:12:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696180363; cv=pass; d=google.com; s=arc-20160816; b=bSXINaOvlk8758weqOg3jSHK4ySebvaHmqaTS/uxYBodlTz3b7HiIqlpLPTEDLZd1g VQz5oc4AKKG9v28E1VXp+8KbGuxFRgTj+mQEP819F97u5/BaplAsztSYJYwt4mVG/duJ fFuylNFvmCPl6ORdAyiePhS2x1Aq3BEhj2fhURUvwdIj+v/GU18jwD/1IoAw4IofoLhI FefGQdVXbpweaI4l+gYr3X3OhwfD92JUYpi3QfyYaigI6kkG3YcxvlHMiTRNlYRgOHtN jczvSu15PH5SFzjaDUmcFCZ2kqLy83n8j/Kfr3IMYcdkmTgf5lokRbzgTcp0bMBtz281 +fdg== 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:content-disposition :message-id:subject:cc:to:from:date:dkim-signature; bh=usDYAF7/Uio4et+c3RkYZX2RrThASPQaEumJNzznkQ0=; fh=YoKn3rNui1Uy12poG2FqwVn8fhiNCgV4MVj74J55Nj8=; b=K2apM+I75ThsJGMO7PkHptRuw5KEsOe5VwBsRktOOyrmFhR44O2hr6ZDepEq9fEqM8 /tnRmEhfj3vbuOGy+oDICYCuh9qaRpz0HDR9Fuvdt8oZmCPXPHRlzMODQPQxXOIrkS1R 165mBxgO1SYWjXq2R3RWTlwk0yAug7ijOOKOy8x1fKs6WqlDwIUyFk1K5BvAgjgXUISD i42lRAyZ2SHb24BHFqt/efPAOZsjCO1fbCUGGYkEfRmlxgzDH74nRYDmXwElj3rIrjbw XpNARGZuR+5gtFzyyOVmQ82PHA5ueOD6Vo++a6cxSf+TiqiDGf9/jiPJ2eV3Ai1G+cIm JIog== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b=sc66DwpN; 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 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id j19-20020a17090ae61300b0027761a3a4b0si5964248pjy.0.2023.10.01.10.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 10:12:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b=sc66DwpN; 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 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 8D50F818C78B; Sun, 1 Oct 2023 01:50:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234543AbjJAIts (ORCPT + 19 others); Sun, 1 Oct 2023 04:49:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231649AbjJAItq (ORCPT ); Sun, 1 Oct 2023 04:49:46 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2057.outbound.protection.outlook.com [40.107.21.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D1E3B4; Sun, 1 Oct 2023 01:49:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZW0DV+Hd+rJOkpaelHM7xSUtq6xuSFmHPEWkBId+6AVDT6yArjHv9ApkMhgUWnf1fHyWOOdiQHUphOGfDOFSWj8S8FFCFVG0aTsmYlM0S0kSJuhUIVe1KyqwBxgQZ3NIj+HYnu2CZnguMcrX54PXC9m4YwQPq2FNQ2dtnA0uEBzxyIwv/4aNK3Eo2I9xukP8Y8S7xik8P1UWp9Js2k2DXHUVYvn0hmk48jBQWza5jrh40xaRA6WHaQOy1r10pgalvFEmmwG/+u/G9x660Cv4T9iOvy96SFUWcNf5/2It301K4qZBu3wp+n8sVpxmuykcr/RZ7+2JvHix3N5VTaMCSA== 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=usDYAF7/Uio4et+c3RkYZX2RrThASPQaEumJNzznkQ0=; b=Er75ThYR2MzzBr+TrWVFs+w6d2Vm2VaBKNeqjp/F/LbLJ47lEIpY2w2nKxgiAvEzwJ/qH9LI5KA7ttQixVywNu6V8DlMQnosDmsnNzlXFVQzQhMFnFy9XMnPUjnbk0qeKKta4UZl5v0QVfzFFb168WFl75+bpHvk46ay4XKFOY+FDya4Pumhr5U9Fyz8kKbMEbD2mAFi+StG7mYDkNkxK3LlOj8fu0v+hq990uQDcfy+MvgnUhKiGVA3a2pK3AmLADNYnTUwyau6Q6g7gfrB8WEWMNZEnSTuJhHLCybpzzbkRGjJFUgJPkdoniV6aZ9WKasGGa1aSOgZv9mpAY7iUg== 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=usDYAF7/Uio4et+c3RkYZX2RrThASPQaEumJNzznkQ0=; b=sc66DwpNuTRHF2+cV7bLAJMQcHpjPMGGIKupaK4LRQylc0YDbavBqDa+BT2bszMlc0379zDQ8YfizqYngTQ3R5Ivt3kbG4AJz71PisRMtvxyqgt1zFPOWeyw7tRMfQynqkqVP7gsakie63qInJUdz5ZFZPaDaWrFByFxW4MNOf8zs+5cx2v+2fE7GOa9upDHkL7aoR0CMlBPl4KoLyLJX823fAvNha7PreIYOJey6/LZT0k0bUQuHEoAR7M+/jdY4CXcBt1YfMg0CkQFtM/J+vE2waHC+tNcYBbdo0Weo30BdmaU9gX8PjdDH5sVjSe66UNWQGa3O4Q2C2yaunovjw== 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 AM9PR04MB8986.eurprd04.prod.outlook.com (2603:10a6:20b:409::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.29; Sun, 1 Oct 2023 08:49:40 +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:49:40 +0000 Date: Sun, 1 Oct 2023 16:49:34 +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 with the device which has same BD_ADDR Message-ID: <20231001084934.GA16906@linux-691t> Content-Disposition: inline User-Agent: Mutt/1.11.4 (2019-03-13) X-ClientProxiedBy: FR2P281CA0080.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9a::13) To DB8PR04MB7164.eurprd04.prod.outlook.com (2603:10a6:10:129::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8PR04MB7164:EE_|AM9PR04MB8986:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d08ddf5-adf7-4232-2f2c-08dbc25b596e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B45zzL+hacsepbz9Th62kFJmFrjBwBtLUbfduq80WCzG7OrdljJH8muTIAOGOpePSeSHbL8ok8KEIqm41w6ZkwaDNI9nUjG2uM4ib+krkxAXd3eJd9gbqWBFWoa29bao5Ys5dL/v3TaDO+DiQLNgAMO6YRsled8k2/3gbhBxzalOjoL7X6MGoJJDimRrSbHSqZ8KpSBE5+MQpObhhXE1VRHOzXg6UjV9kc0HiKefyk3eYnXp4qYNqPOb6VEcdBn8ra59RTfYmTiApnwo42LnKN7jYmTZcmQK0Bom4jBZQ3aRaE/Rtl4e7qxVBZteeXGQuFw8A3cgdAAPyXkyCNKtQWVoO75zNKmKzhiXNsiNAYulpDPS3DSEjVGksuboarYZoAGZiExOaylgVZS1SkRe7Oe1+n6tdvy7iTgDP53rXjFSJWV4Xhh67Db2WRPmeT/UCOUsd7L0SZY5YSgO28t5uJIP4EZMboXbRifL4f30MasCKG0D7XmzgaRJs3tSuw9gzg2GZdHmF79HyufacYY7MMwWLK8OOUQQ+zP0NJouQh8= 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)(396003)(346002)(136003)(366004)(39860400002)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(6512007)(9686003)(1076003)(26005)(38100700002)(33716001)(33656002)(86362001)(83380400001)(478600001)(66476007)(316002)(8676002)(8936002)(4326008)(5660300002)(66556008)(66946007)(966005)(6486002)(110136005)(6506007)(6666004)(41300700001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aN8MLYD/a81g8Mwbyg6czQGOqEuejRaGg2KbFQj5wv0pxhInW+lj2nIl3XgHR8UujJvX8BsiSYeavaxEX8IKrrwIXKg0Pc2/a6E88zM/64aKZdPBepSkHkRXIde1fLRSGWcjLl6x8BipyJqdq7oEAHr8hyKDzktSbIMw+nzMGrrvBHmfR4x6O4gKwiXqSrQgi2VNxjYsKOpZnR2eWgPcaRL6zNicUjKSSMnrD7ktt5Mq3t8yT/XW5SlCYgL/epvw2S13r53c+b0xsBfaBFkjuUmVT6wKkbeNv5AJC4Q4LsWKJtuzDgzxwkmZl+AOsDrlzhEgfZqQGfDEXOwawuJitR/l96OOamlJ+K+BxyWIMrYFlUUmgOHWEFYrt77qs9RlcoZKjZb5eAH3r7unl4hYQm5/kTS+CsboF9fv0O8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f9/UHQYo+02XYmf70fRVoB7KL2xQB3NDRc+A3d0KvsL6Xq6mRaJPUS9Z4bnq6u4c/fZWMNPIfg8tA1sjgCbcL1fd40lMSd3glVWaR4 X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d08ddf5-adf7-4232-2f2c-08dbc25b596e 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:49:40.2216 (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: EW+1KxmUsSBibfAivcjKAqVC5uS9jYcUx8FC2VXlLWnoNV3ZhLXYEyciahhrewrO X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8986 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 01 Oct 2023 01:50:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778539822348518212 X-GMAIL-MSGID: 1778574020815247951 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(+)