Section 7.22

Just Works

Definition

Just Works is the association method of Bluetooth Low Energy §7.1 (LE) pairing §7.17 in which the user compares nothing and types nothing, so nothing checks that each device pairs with the intended other device. Pairing uses it when no out-of-band data is present and either no device requests protection against a man-in-the-middle §7.26 (MITM) attacker or the input and output capabilities allow nothing stronger. Its keys are classed unauthenticated. Under LE Secure Connections §7.21 it still defeats an eavesdropper; under LE legacy pairing §7.20, whose temporary key it sets to zero, it does not.

The idea

A wireless earbud has no screen and one button; a temperature sensor may have neither. Passkey entry §7.23 needs a keyboard on one side, numeric comparison §7.24 needs a display and a yes button on both, and out-of-band association §7.25 needs a second channel such as NFC (near-field communication). When none of these is available, pairing must still complete, or the devices cannot be used together at all. Just Works lets it complete.

What disappears is the check that the device being paired is the one the user means. Encryption keeps out anyone who does not hold the key, but under Just Works anyone in radio range during pairing can become a holder of the key. Picture sealing a letter in an envelope that only the addressee can open, after asking a stranger in the street for the addressee’s address. The seal is perfect; the address may be the stranger’s. The picture stops at one point: the attacker has to be present during the short pairing itself. If pairing completed with no attacker present and the keys were stored, later connections are protected as well as the stored keys are.

How it works

Just Works is not a separate protocol. It is the protocol of the chosen pairing procedure with its user step left out.

  1. Selection. During the pairing feature exchange, each device declares its IO capability (input and output: display, keyboard, yes and no buttons) and sets or clears the MITM flag, a bit that asks for protection against a man-in-the-middle. Just Works is chosen when the condition for out-of-band association is not met and either neither device set the MITM flag, or the IO capabilities allow nothing else: one device declares NoInputNoOutput, or both have displays but neither has a keyboard (under LE legacy pairing this includes two DisplayYesNo devices, which under LE Secure Connections would use numeric comparison).

  2. Under LE legacy pairing. The temporary key (TK), the secret from which the short-term key is computed, is set to zero. The confirm and random values are exchanged as usual, so the protocol runs, but every input of the key computation is either zero or sent over the air in the clear. Anyone who recorded the pairing can compute the short-term key and then read the long-term key §7.28 (LTK) sent under it.

  3. Under LE Secure Connections. The devices exchange public keys and compute a shared secret by elliptic-curve Diffie–Hellman §19.1.5 (ECDH) key agreement, exchange the commitment and nonces §5.18 of the numeric comparison protocol, and complete the final key checks, but the six-digit value is never shown and the user confirms nothing. An eavesdropper cannot compute the shared secret; an attacker who replaces both public keys is not detected.

  4. Result. The key is stored as unauthenticated. A link encrypted with it reaches level 2 of LE security mode §7.33 1 (unauthenticated pairing with encryption), not level 3 (authenticated pairing with encryption) or level 4 (authenticated LE Secure Connections pairing with a 128-bit key).

  5. Confirmation prompts. Many devices ask “Pair with Thermostat?” and wait for a tap. The user then confirms only that pairing should happen. No value tied to the keys is compared, and the name on the screen is whatever the answering device chose to send. The method is still Just Works.

What an active intermediary does. An attacker M within radio range at pairing time makes each victim pair with M instead of with the other victim, for example by advertising under the peripheral’s name and address so that the central connects to M, while M itself connects to the peripheral. M runs two pairings, one with each victim, each time pretending to be the other victim. Both complete, because nothing is compared. Victim A holds key K1K_1, shared with M; victim B holds key K2K_2, shared with M. M can then:

Worked example

A phone P (KeyboardDisplay, the central) pairs with a thermostat T (NoInputNoOutput, the peripheral). P sends AuthReq (the authentication §1.6 requirements byte) 0x0D, binary 0000 1101: bonding §7.18, MITM protection requested, LE Secure Connections supported. T answers 0x09, binary 0000 1001: bonding and LE Secure Connections, no MITM request. One MITM flag is set, so the IO capabilities decide, and T is NoInputNoOutput, so the method is Just Works. P asked for MITM protection and did not get it: the key is unauthenticated, and only P’s own check of the outcome reveals that.

An attacker M is present. P pairs with M and gets key K1K_1; M pairs with T and gets key K2K_2. P sends “set the target temperature to 20 degrees Celsius”, encrypted under K1K_1. M decrypts it with K1K_1, changes 20 to 30, encrypts the new command under K2K_2 and sends it to T. T decrypts it with K2K_2; the integrity §1.9 check passes, because M encrypted correctly; and T sets 30 degrees. Both links were encrypted at every step.

Compare the attacker’s chances. Under Just Works the attempt succeeds with probability 1, because there is no check to pass. Had both devices been able to use numeric comparison, the six-digit values on P and T would have differed with probability 1−10−6=0.9999991 - 10^{-6} = 0.999999, and a user who compared them would have rejected the pairing.

Stated precisely

Just Works provides exactly the following.

The contract a system must keep: a key from Just Works is unauthenticated, and a link encrypted with it must not be described or treated as protected against a man-in-the-middle. A policy that needs that protection must require security level 3 or 4 and refuse Just Works. A policy that accepts Just Works accepts that its peer may be an attacker.

Limits and common mistakes

Encryption does not imply authentication. An encrypted link shows that the other end holds the key, not who the other end is.

Just Works is not always chosen on purpose: it follows from the declared IO capabilities and MITM flags, which are sent unprotected. An attacker in the middle can change the declared capabilities in transit so that Just Works is chosen, a downgrade attack §1.27. A device that requires authentication must check the method that results.

Correct encryption cannot repair missing authentication. Only an authenticated method, or authentication at a higher layer, such as an application protocol that checks a key installed at the factory, can supply it.

Do not carry the LE Secure Connections argument over to LE legacy pairing: legacy Just Works does not even resist a passive recording.

A man-in-the-middle cannot be detected afterwards from the link alone: both victims’ links look normal.

Making a device accept pairing only for a short time after a button press narrows the attacker’s window but does not authenticate the peer.

Questions answered

What can an active intermediary do during an unauthenticated exchange?

An active intermediary present during an unauthenticated pairing, such as Bluetooth Just Works pairing, can make itself the other endpoint of each device’s key exchange, and so read, change, drop and inject all later traffic while both devices see a correctly encrypted link.

  1. It intercepts the pairing messages and runs one complete pairing with each device, each time pretending to be the other device. Under LE Secure Connections, the Bluetooth Low Energy pairing procedure based on elliptic-curve Diffie–Hellman key agreement, it substitutes its own public key in each exchange; nothing is compared, so both pairings succeed.

  2. Each device now holds a key shared with the intermediary: device A holds K1K_1, device B holds K2K_2, and the intermediary holds both.

  3. It relays traffic: it decrypts each message from A with K1K_1, reads or alters it, re-encrypts it with K2K_2 and forwards it to B, and does the same in the other direction. It can also drop messages, inject its own commands, or talk to one device alone while posing as the other.

  4. If the devices bond, that is, store the keys for later connections, each stores the intermediary’s key, so the intermediary keeps its position at later connections.

What it cannot do is break the cryptography: under LE Secure Connections, an outsider who only listens learns nothing, and the damage comes entirely from the missing check of who holds the other end. Under LE legacy pairing, Just Works is weaker still: its temporary key is zero, so even a passive listener who recorded the pairing can compute the keys.

Related entries: LE legacy pairing (§7.20), LE Secure Connections (§7.21), MITM attack (§7.26), Security Manager Protocol (SMP) (§7.19), Numeric comparison (§7.24), Bonding (§7.18), Security level (§7.33), Downgrade attack (§1.27). Further reading: [18].