Top Banner
Hardwear.io Virtual Con 2020 From the Bluetooth Standard to Standard-Compliant 0-days Daniele Antonioli and Mathias Payer Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days 1
35

From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Aug 11, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Hardwear.io Virtual Con 2020

From the Bluetooth Standard to Standard-Compliant0-days

Daniele Antonioli and Mathias Payer

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days 1

Page 2: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Who We Are

• Daniele AntonioliI Security researcher, Postdoc at EPFLI @francozappaI More: https://francozappa.github.io

• Mathias PayerI Security researcher, Professor at EPFLI @gannimoI More: https://nebelwelt.net/

• We are researchers in the HexHive groupI System security topicsI More: https://hexhive.epfl.ch/

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Bio 2

Page 3: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Bluetooth Standard

• Bluetooth StandardI Complex document (Bluetooth Core v5.2, 3.256 pages)I Specifies Bluetooth Classic (BT) and Bluetooth Low Energy (BLE)

https://www.bluetooth.com/specifications/bluetooth-core-specification/

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Cover 3

Page 4: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Standard-Compliant 0-days

• Standard-compliant 0-day (security vulnerability)I Unknown and/or unaddressedI Agnostic to hardware, and software implementation detailsI Very effective (1 vuln = all standard-compliant devices are exploitable)I Difficult to patch (firmware upgrades, device recall)

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Cover 4

Page 5: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Key Negotiation of Bluetooth (KNOB) Attacks

• KNOB attacks on Bluetooth Low Energy (BLE) and Bluetooth Classic (BT)I Exploiting standard-compliant 0-days in Bluetooth key negotiation

• Related work (cc: Nils Tippenhauer and Kasper Rasmussen)I “The KNOB is Broken: Exploiting Low Entropy in the Encryption Key Negotiation Of

Bluetooth BR/EDR” [SEC19]I “Key Negotiation Downgrade Attacks on Bluetooth and Bluetooth Low Energy” [TOPS20]

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Cover 5

Page 6: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Bluetooth Security

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Bluetooth Security 6

Page 7: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Bluetooth Security Overview

• PairingI Establish a long term key (SSP based on ECDH)

• Secure session establishmentI Establish a session key (derived from pairing key)

• Security mechanismsI Association: protect against man-in-the-middle attacksI Key negotiation: negotiate a key with variable entropy (strength)

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Bluetooth Security 7

Page 8: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Bluetooth Threat Model

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Bluetooth Security 8

Page 9: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Bluetooth Threat Model

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Bluetooth Security 8

Page 10: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Bluetooth Threat Model

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Bluetooth Security 8

Page 11: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Bluetooth Threat Model

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Bluetooth Security 8

Page 12: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

KNOB attack on BLE

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days KNOB BLE 9

Page 13: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

BLE Pairing: Overview

Alice (master)

A

Bob (slave)

B

Phase 1: Feature exchange (including key negotation)

Phase 2: key establishment and optional authentication

Phase 3: key distribution (over encrypted link)

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days KNOB BLE 10

Page 14: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

BLE Pairing: Key Negotiation

Alice (master)

A

Bob (slave)

B

Pairing Request: IO, AuthReq, KeySize, InitKey, RespKey

Pairing Response: IO, AuthReq, KeySize, InitKey, RespKey

Phase 1: Feature exchange (including key negotation)

• Key negotiation issues (standard-compliant 0-days)I KeySize negotiation is not protected, i.e. no integrity, no encryptionI KeySize values between 7 bytes and 16 bytes

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days KNOB BLE 11

Page 15: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

KNOB Attack on BLE Feature Exchange

Alice (master)

A

Charlie (attacker)

C

Bob (slave)

B

IO, AuthReq, KeySize: 16, InitKeys, RespKeys IO, AuthReq, KeySize: 7, InitKeys, RespKeys

IO, AuthReq, KeySize: 16, InitKeys, RespKeysIO, AuthReq, KeySize: 7, InitKeys, RespKeys

Phase 1: Feature exchange (including key negotiation)

Phase 2: Key establishment and optional authentication

Phase 3: Key distribution over encrypted link

• KNOB attack on BLE pairingI Attacker downgrades KeySize to 7 bytesI Victims’ pairing and session keys have 7 bytes of entropyI Attacker brute-forces the low-entropy keys

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days KNOB BLE 12

Page 16: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Implementation of KNOB Attack on BLE

• Security Manager Protocol (SMP) manipulationI Implemented in the BLE host (OS)

• Custom Linux kernelI net/bluetooth/smp.c: SMP_DEV(hdev)->max_key_size = 7

• Custom user-space BLE stackI Based on PyBT (https://github.com/mikeryan/PyBT)I That is based on scapy (https://scapy.net)

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days KNOB BLE 13

Page 17: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Evaluation of BLE KNOB Attack (19 devices, from Oct 2019)

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days KNOB BLE 14

Page 18: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

KNOB attack on BT

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days KNOB BT 15

Page 19: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

BT Pairing

• Alice and BobI Securely paired over BT in absence of CharlieI Share a strong pairing key (16 bytes of entropy)

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days KNOB BT 16

Page 20: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

BT Session Establishment: Overview

Alice (master)

A

Bob (slave)

B

Phase 1: Pairing key authentication

Phase 2: Session key negotation

Phase 3: Start encryption

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days KNOB BT 17

Page 21: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

BT Session Establishment: Session Key Negotiation

Alice (master)

A

Bob (slave)

B

Key entropy: 16

Key entropy: 15

Accept

Phase 2: Session key negotation

• Key negotiation issues (standard-compliant 0-days)I Key entropy negotiation is not protected, i.e. no integrity, no encryptionI Key entropy values between 1 byte and 16 bytes

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days KNOB BT 18

Page 22: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

KNOB Attack on BT Session Key Negotiation

Alice (master)

A

Charlie (attacker)

C

Bob (slave)

B

Phase 1: Pairing key authentication

Key entropy: 16 Key entropy: 1

AcceptKey entropy: 1

Accept

Phase 2: Session key negotation

Phase 3: Start encryption

• KNOB attack on BT secure session establishmentI Attacker downgrades key entropy to 1 bytesI Attacker brute-forces the low-entropy key

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days KNOB BT 19

Page 23: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Implementation of KNOB Attack on BT

• Link Manager Protocol (LMP) manipulationI Implemented in the BT controller (firmware)

• Custom version of internalblueI RE Nexus 5 BT firmwareI Write ARM patches for LMPI Patch Nexus 5 at runtime

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days KNOB BT 20

Page 24: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Evaluation of BT KNOB Attack (38 devices, from Jun 2019)

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days KNOB BT 21

Page 25: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Evaluation of BT KNOB Attack (38 devices, from Jun 2019)

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days KNOB BT 21

Page 26: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

KNOB Attacks Countermeasures

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Countermeasures 22

Page 27: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Our countermeasures for BT and BLE

• Legacy-compliantI Set minimum entropy value to 16 bytesI Enforce key entropy of 16 bytes

• Non legacy-compliantI Integrity protect key negotiationI Remove entropy negotiation feature

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Countermeasures 23

Page 28: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Bluetooth SIG amended the standard (2019-08-13)

• Erratum 11838: Encryption Key Size UpdatesI BT minimum entropy value now is 7 bytes, BLE stays the sameI Mandatory for Bluetooth versions: 4.2, 5.0, 5.1, 5.2

https://www.bluetooth.org/docman/handlers/DownloadDoc.ashx?doc_id=470741

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Countermeasures 24

Page 29: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

KNOB on BT: Apple mitigation

https://twitter.com/seemoolab/status/1169363042548760577/photo/1

• Notify the user if key entropy is lower than 7 bytesI Accept any entropy value if user presses Allow (once)

• Shifting responsibilities to users is bad!I Users do not care, accidentally press, are tricked to press

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Countermeasures 25

Page 30: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

KNOB on BT: Google and Linux mitigation

• OS patchI Checks entropy and terminates the session if entropy is less than 7 bytesI Uses HCI Read Encryption Key Size command

• Shifting responsibilities to the OS can still be bad!I Malicious OS can still negotiate 1 byte of entropy

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Countermeasures 26

Page 31: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Conclusion

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Conclusion 27

Page 32: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

KNOB BT vs. BLE: Pairing

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Conclusion 28

Page 33: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

KNOB BT vs. BLE: Secure Session Establishment

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Conclusion 29

Page 34: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

Current State of Bluetooth security

• 7 bytes of entropy for a key is too low (comparable to DES)

• BT and BLE key negotiations remain un-protected

• Entropy negotiation does not provide runtime benefits (key size stays constant)

• Most of the BT devices are still vulnerable to the 1 byte downgrade

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Conclusion 30

Page 35: From the Bluetooth Standard to Standard-Compliant 0-days · Bluetooth Security Overview • Pairing I Establish a long term key (SSP based on ECDH) • Secure session establishment

From the Bluetooth Standard to Standard-Compliant 0-days

• Bluetooth StandardI Specifies Bluetooth Classic (BT) and Bluetooth Low Energy (BLE)

• Standard-compliant 0-days (vulnerabilities)I Very effective and difficult to patch

• Key Negotiation of Bluetooth (KNOB) attacks on BT and BLEI More info at https://knobattack.comI Try it yourself at https://github.com/francozappa/knob

Daniele Antonioli (@francozappa) Mathias Payer (@gannimo) From the Bluetooth Standard to Standard-Compliant 0-days Conclusion 31