The KNOB Is Broken: Exploiting Low Entropy in The Encryption Key Negotiation of Bluetooth BR/EDR
The KNOB Is Broken: Exploiting Low Entropy in The Encryption Key Negotiation of Bluetooth BR/EDR
The KNOB Is Broken: Exploiting Low Entropy in The Encryption Key Negotiation of Bluetooth BR/EDR
′
Alice and Bob use an encryption key KC with 1 byte of entropy
Figure 4: The KNOB attack sets the entropy of the encryption key (KC0 ) to 1 byte. Alice requests Bob to activate encryption and
starts the encryption key negotiation protocol. The attacker (Charlie) changes the entropy suggested by Alice from 16 to 1 byte.
Bob accepts Alice’s proposal and Charlie changes Bob’s acceptance to a proposal of 1 byte. Alice, who originally proposed 16
bytes of entropy and she is asked to use 1 byte accepts the (standard-compliant) proposal. Charlie drops Alice’s acceptance
message because Bob already accepted Alice’s proposal (modified by Charlie). Charlie does not know any pre-shared secret and
does not observe SSP.
values by setting two parameters defined as Lmin and Lmax . requests to activate (set) encryption. Alice’s Bluetooth con-
These values can be set and read only by the Bluetooth chip troller accepts the local requests and starts the encryption key
(firmware). Indeed, our scenario describes a situation where negotiation procedure with Bob’s Bluetooth controller over
Alice’s Bluetooth firmware declares Lmax = 16 and Lmin = 1, the air. The attacker intercepts Alice’s proposed key entropy
and Bob’s Bluetooth firmware declares Lmax = Lmin = 1. and substitutes 16 with 1. This simple substitution works
The encryption key negotiation protocol is carried over because LMP is neither encrypted nor integrity protected.
the Link Manager Protocol (LMP). The first two messages Bob’s controller accepts 1 byte. The attacker intercepts Bob’s
in Figure 3 allow Alice to authenticate that Bob possesses acceptance message and change it to an entropy proposal of
the correct KL . Then, with the next two messages, Alice 1 byte. Alice thinks that Bob does not support 16 bytes of
requests to initiate Bluetooth link layer encryption and Bob entropy and accepts 1 byte. The attacker intercepts Alice’
accepts. Now, the negotiation of N takes place (Negot’n in acceptance message and drops it. Finally, the controllers of
Figure 3). Alice proposes 16 bytes of entropy. Bob can Alice and Bob compute the same KC0 with one byte of entropy
either propose a smaller value or accept the proposed one or and notify their respective hosts that link-layer encryption
abort the negotiation. In our example, Bob proposes 1 byte is on.
of entropy because it is the only value that he supports and
It is reasonable to think that the victim could prevent or
Alice accepts it. Then, Alice requests to activate link-layer
detect this attack using a proper value for Lmin . However, the
encryption and Bob accepts. Finally, Alice and Bob compute
standard does not state how to explicitly take advantage of
the same encryption key (KC0 ) that has 1 byte of entropy. Note
it, e.g., deprecate Lmin values that are too low. The standard
that, the Bluetooth hosts of Alice and Bob do not have access
states the following: “The possibility of a failure in setting
to KC and KC0 , they are only informed about the outcome of
up a secure link is an unavoidable consequence of letting the
the negotiation. The key negotiation procedure can also be
application decide whether to accept or reject a suggested
initiated by the Bob (the slave), resulting in the same outcome.
key size.” [6, p. 1663]. This statement is ambiguous because
Figure 4 describes how the attacker (Charlie) manages to it is not clear what the definition of “application” is in that
let Alice and Bob agree on a KC0 with 1 byte of entropy when sentence. As we show in Section 5, this ambiguity results in
both Alice and Bob declare Lmax = 16 and Lmin = 1. In this no-one being responsible for terminating connections with
Figure we also show the local interactions between hosts and low entropy keys in practice. In particular, the entity who
controllers to emphasize that at the end of the negotiation the decides whether to accept or reject the entropy proposal is
hosts are not informed about N and KC0 . the firmware of the Bluetooth chip by setting Lmin and Lmax
The attack is performed as follows: Alice’s Bluetooth host and participating in the entropy negotiation protocol. The
Table 1: Relevant technical specifications of Nexus 5 and Motorola G3 devices used to describe our attack implementation. The
SC column indicates if a device supports Secure Connections.
Nexus 5 phones. To use it, one has to root the target Nexus 5 whenever an LMP packet is received. The hooks are intended
and compile and install the Android Bluetooth stack with for LMP monitoring, and we upgraded them to be used also
debugging features enabled. InternalBlue allows to patch the for LMP manipulation.
firmware in real-time (e.g., start LMP monitoring) and read Listing 1 shows three ARM assembly code blocks that we
the ROM and the RAM of firmware at runtime. Internal- added to fw 5.py to let the Nexus 5 and the Motorola G3
Blue provides a way to hook and execute arbitrary code in negotiate 1 byte of entropy. In this case the Nexus 5 is the
the Bluetooth firmware. At the time of writing, InternalBlue master and it initiates the encryption key negotiation protocol.
is not capable of hooking directly the key negotiation logic. The first block translates to: if the Nexus 5 is sending an
However, we managed to extend it to enable two victims (one LMP KC0 entropy proposal then change it to 1 byte. This
is always the Nexus 5) to negotiate one (or more) byte of block is executed when the Nexus 5 starts an encryption key
entropy. negotiation protocol. The code allows to propose any entropy
Our manipulation of the entropy negotiation works regard- value by moving a different constant into r2 in line 5.
less the role of the Nexus 5 in the piconet and it does not The second block from Listing 1 translates to: if the
require to capture any information about the Secure Simple Nexus 5 is receiving an LMP accept (entropy proposal), then
Pairing process. Assuming that the victims are already paired, change it to an LMP KC0 entropy proposal of 1 byte. This
we test if two victims are vulnerable to the KNOB attack as code is used to let the Nexus 5 firmware believe that the other
follows: victim proposed 1 byte, while she already accepted 1 byte (as-
suming that she is vulnerable). The third blocks translates to:
1. We connect over USB the Nexus 5 with the X1 laptop, if the Nexus 5 is sending an LMP accept (entropy proposal),
we run our version of InternalBlue, and we activate LMP then change it to an LMP preferred rate. This allows to obtain
and HCI monitoring. the same result of dropping an LMP accept packet because
the LMP preferred rate packet does not affect the state of the
2. We connect and start the Ubertooth One capture over the
encryption key negotiation protocols. We developed and used
air focusing only on the Nexus 5 piconet (using UAP
similar patches to cover the other attack cases: Nexus 5 is the
and LAP flags).
master and does not initiate the connection, Nexus 5 is the
3. We request a connection from the Nexus 5 to the victim slave and initiates the connection and Nexus 5 is the slave
(or vice versa) to trigger the encryption key negotiation and does not initiate the connection.
protocol over LMP.
4. Our InternalBlue patch changes the LMP packets as 4.3 Brute Forcing the Encryption Key
Charlie does in Figure 4.
Once the attacker is able to reduce the entropy of the en-
5. If the victims successfully complete the protocol, then cryption key (KC0 ) to 1 byte, he has to brute force the key
they are vulnerable to the KNOB attack and we can value (key space is 256). In this section we explain how we
decrypt the ciphertext captured with the Ubertooth One. brute forced and validated a E0 encryption key with 1 byte
of entropy. The key was used in one of our KNOB attacks
We now describe how we extended InternalBlue to perform to decrypt the content of a file transferred over a link layer
the fourth step of the list. In this context, the most important encrypted Bluetooth connection.
file of InternalBlue is internalblue/fw 5.py. This file The details about the E0 encryption scheme are presented
contains all the information about the BCM4339 firmware, in Figure 6, we describe them backwards starting from the E0
and it provides two hooks into the firmware, defined by Mantz cipher. E0 takes three inputs: BTADDM , CLK26-1 and KC0 .
(the main author of InternalBlue) as LMP send packet and CLK26-1 are the 26 bits of CLK in the interval CLK[25:1]
LMP dispatcher. The former hook allows to execute code (assuming that CLK stores its least significant bit at CLK[0]).
every time an LMP packet is about to be sent and the latter The BTADDM is the Bluetooth address of the master and it
[12] Glenn Greenwald. No place to hide: Edward Snowden, [25] John Padgette. Guide to bluetooth security. NIST Special
the NSA, and the US surveillance state. Metropolitan Publication, 800:121, 2017.
Books, 2014. [26] Christina Pöpper, Nils Ole Tippenhauer, Boris Danev,
[13] Keijo Haataja and Pekka Toivanen. Two practical man- and Srdjan Čapkun. Investigation of signal and message
in-the-middle attacks on bluetooth secure simple pairing manipulations on the wireless channel. In Proceedings
and countermeasures. IEEE Transactions on Wireless of the European Symposium on Research in Computer
Communications, 9(1), 2010. Security (ESORICS), December 2011.
[14] IETF. Counter with CBC-MAC (CCM). https:// [27] Jordan Robertson and Michael Riley. The Big
www.ietf.org/rfc/rfc3610.txt, Accessed: 2018- Hack: How China Used a Tiny Chip to Infiltrate
10-28. U.S. Companies. https://www.bloomberg.com/
news/features/2018-10-04/the-big-hack-
[15] Markus Jakobsson and Susanne Wetzel. Security weak- how-china-used-a-tiny-chip-to-infiltrate-
nesses in Bluetooth. In Cryptographers’ Track at the america-s-top-companies, Accessed: 2018-10-30.
RSA Conference, pages 176–191. Springer, 2001.
[28] Yaniv Shaked and Avishai Wool. Cracking the Blue-
[16] Avinash Kak. BitVector.py. https://engineering. tooth PIN. In Proceedings of the conference on Mobile
purdue.edu/kak/dist/BitVector-3.4.8.html, systems, applications, and services (MobiSys), pages
Accessed: 2018-10-28. 39–50. ACM, 2005.
A Appendix
The Key Negotiation Of Bluetooth (KNOB) attack reduces
the entropy of the encryption key (KC0 ) to 1 byte (key space
has 256 elements). Table 4 shows twenty encryption keys
with one byte of entropy both for E0 and AES-CCM.
E0 KC0 in hex, MSB on the left AES-CCM KC0 in hex, MSB on the left
0x00000000000000000000000000000000 0x00000000000000000000000000000000
0x00e275a0abd218d4cf928b9bbf6cb08f 0x01000000000000000000000000000000
0x01c4eb4157a431a99f2517377ed9611e 0x02000000000000000000000000000000
0x01269ee1fc76297d50b79cacc1b5d191 0x03000000000000000000000000000000
0x0389d682af4863533e4a2e6efdb2c23c 0x04000000000000000000000000000000
0x036ba322049a7b87f1d8a5f542de72b3 0x05000000000000000000000000000000
0x024d3dc3f8ec52faa16f3959836ba322 0x06000000000000000000000000000000
0x02af4863533e4a2e6efdb2c23c0713ad 0x07000000000000000000000000000000
0x0713ad055e90c6a67c945cddfb658478 0x08000000000000000000000000000000
0x07f1d8a5f542de72b306d746440934f7 0x09000000000000000000000000000000
0x06d746440934f70fe3b14bea85bce566 0x0a000000000000000000000000000000
0x063533e4a2e6efdb2c23c0713ad055e9 0x0b000000000000000000000000000000
0x049a7b87f1d8a5f542de72b306d74644 0x0c000000000000000000000000000000
0x04780e275a0abd218d4cf928b9bbf6cb 0x0d000000000000000000000000000000
0x055e90c6a67c945cddfb6584780e275a 0x0e000000000000000000000000000000
0x05bce5660dae8c881269ee1fc76297d5 0x0f000000000000000000000000000000
0x0e275a0abd218d4cf928b9bbf6cb08f0 0x10000000000000000000000000000000
0x0ec52faa16f3959836ba322049a7b87f 0x11000000000000000000000000000000
0x0fe3b14bea85bce5660dae8c881269ee 0x12000000000000000000000000000000
0x0f01c4eb4157a431a99f2517377ed961 0x13000000000000000000000000000000