Section 7.21

LE Secure Connections

Full name: Low Energy Secure Connections.

Definition

LE Secure Connections is the pairing §7.17 procedure that version 4.2 of the Bluetooth Core Specification added to Bluetooth Low Energy (BLE) §7.1. The devices run elliptic-curve Diffie–Hellman §19.1.5 (ECDH) key agreement on the curve P-256: each sends a public key, keeps the matching private key, and both compute the same shared secret, from which they derive the long-term key §7.28 (LTK). An eavesdropper cannot compute that secret. Protection against an active attacker comes separately, from the association method: numeric comparison §7.24, passkey entry §7.23 and out-of-band association §7.25 give it; Just Works §7.22 does not.

The idea

LE legacy pairing §7.20, the older procedure, has a weakness no user effort can repair: its only secret is the temporary key, which is zero under Just Works and a six-digit number under passkey entry, so an eavesdropper who records the pairing can compute every key. LE Secure Connections adds a Diffie–Hellman key agreement §19.1.4. Each device picks a secret number and sends a public value computed from it; from its own secret and the other’s public value, each computes the same shared secret. An eavesdropper sees both public values but neither secret, and computing the shared secret from the public values alone is believed infeasible.

Key agreement solves the listener problem, not the impostor problem. An attacker who can intercept and replace radio messages, an active man-in-the-middle §7.26 (MITM), can run one key agreement with each device. Each device then holds a strong key, shared with the attacker. Picture two people who talk through an interpreter they cannot see: each conversation is private from everyone else, but the interpreter hears both. The cure is a check the attacker cannot fake. In numeric comparison the user compares a six-digit number computed from both devices’ public keys; in passkey entry the user types one number into both devices; in out-of-band association the devices exchange data over a separate channel such as NFC (near-field communication). The picture stops in one respect: the number compared depends on the very public keys exchanged, so an attacker in the middle produces two different numbers, except with a chance of about one in a million.

How it works

Device A is the initiator (the central) and device B the responder (the peripheral). The specification’s names are used below. SKa,SKb\mathrm{SK}_a, \mathrm{SK}_b are the private keys; PKa,PKb\mathrm{PK}_a, \mathrm{PK}_b are the public keys, each a point on P-256, an elliptic curve over a 256-bit prime field §19.1.2 that NIST standardized, written as two 32-byte coordinates, 64 bytes in all; Na,NbN_a, N_b are 128-bit nonces §5.18, random numbers used once; DHKey\mathrm{DHKey} is the 32-byte shared secret. The functions f4f_4, f5f_5, f6f_6 and g2g_2 are built from AES-CMAC §15.7: CMAC (cipher-based message authentication code) computed with the AES (Advanced Encryption Standard) block cipher §15.3.

  1. Feature exchange. Both devices set the SC (Secure Connections) flag in their Pairing Request and Pairing Response; the association method follows from their flags and input and output capabilities.

  2. Public keys. A sends PKa\mathrm{PK}_a and B sends PKb\mathrm{PK}_b. Each device checks that the received key is a point on P-256 (public-key validation); a device that finds an invalid key must not use the resulting LTK. Pairing also fails if the two public keys have the same x-coordinate, so a device rejects its own public key if an attacker sends it back.

  3. Shared secret. A computes DHKey\mathrm{DHKey} as the x-coordinate of the point SKa⋅PKb\mathrm{SK}_a \cdot \mathrm{PK}_b, and B as that of SKb⋅PKa\mathrm{SK}_b \cdot \mathrm{PK}_a; both are the same point.

  4. Authentication §1.6 stage 1, which depends on the method:

    • Just Works and numeric comparison. B sends a commitment Cb=f4(PKb,PKa,Nb,0)C_b = f_4(\mathrm{PK}_b, \mathrm{PK}_a, N_b, 0), a value that fixes NbN_b without revealing it. A sends NaN_a; B sends NbN_b; A checks CbC_b. Both compute g2(PKa,PKb,Na,Nb)g_2(\mathrm{PK}_a, \mathrm{PK}_b, N_a, N_b), a 32-bit number, and take it modulo 10610^6, giving six digits. Under numeric comparison each device displays the six digits and the user confirms that they match. Under Just Works nothing is displayed or confirmed.

    • Passkey entry. The six-digit passkey is at most 999,999, which is 0xF423F and needs 20 bits. The devices run 20 rounds, one per bit; in each round both commit to the bit with a fresh nonce and then reveal in turn.

    • Out-of-band association. Each device sends over the out-of-band channel a random number rr and the commitment f4(PK,PK,r,0)f_4(\mathrm{PK}, \mathrm{PK}, r, 0) to its own public key; the receiver checks the commitment against the public key that arrived over the radio.

  5. Authentication stage 2. Both compute MacKey\mathrm{MacKey} and the LTK as f5(DHKey,Na,Nb,A,B)f_5(\mathrm{DHKey}, N_a, N_b, A, B), where AA and BB here stand for the two device addresses. Each then computes a check value with f6f_6 from MacKey\mathrm{MacKey}, the nonces, a value set by the method (zero for Just Works and numeric comparison, the passkey, or the out-of-band random number), its own input and output capability, out-of-band flag and authentication requirements, and both addresses. A sends its check value; B verifies it and sends its own; A verifies that. A mismatch ends pairing with reason 0x0B, which the specification names DHKey Check Failed.

  6. Encryption. A starts Link Layer §7.6 encryption with the LTK. No short-term key exists in this procedure, and the LTK is never sent; only the identity resolving key §7.29 and the signing key may be sent afterwards.

  7. New key pair. The specification allows a device to replace its private and public key pair at any time and recommends regular replacement, but it does not require a new pair for every pairing.

Worked example

Alice’s phone A pairs with a smart lock B. An attacker M is within radio range.

Passive attacker. M records PKa\mathrm{PK}_a, PKb\mathrm{PK}_b, CbC_b, NaN_a, NbN_b and both check values, but neither SKa\mathrm{SK}_a nor SKb\mathrm{SK}_b. Computing DHKey\mathrm{DHKey} from PKa\mathrm{PK}_a and PKb\mathrm{PK}_b alone is the computational Diffie-Hellman problem §19.1.3 on P-256, for which the best known methods need about 21282^{128} operations. So M learns neither DHKey\mathrm{DHKey} nor the LTK, whatever the association method, Just Works included.

Active attacker with Just Works. M answers A as if it were B, with public key PKm1\mathrm{PK}_{m1}, and connects to B as if it were A, with public key PKm2\mathrm{PK}_{m2}. A computes DHKey1\mathrm{DHKey}_1 from SKa\mathrm{SK}_a and PKm1\mathrm{PK}_{m1}; M computes the same value from its private key and PKa\mathrm{PK}_a. B and M likewise share DHKey2\mathrm{DHKey}_2. Both pairings complete, because Just Works compares nothing. A holds LTK1\mathrm{LTK}_1, B holds LTK2\mathrm{LTK}_2, and M holds both.

Active attacker with numeric comparison. A displays the six digits computed from PKa,PKm1\mathrm{PK}_a, \mathrm{PK}_{m1} and its nonces; B displays those computed from PKm2,PKb\mathrm{PK}_{m2}, \mathrm{PK}_b and its nonces. Suppose g2g_2 gives A the 32-bit value 0x2F9ED5BA, which is 798,938,554; modulo 10610^6 this is 938,554, displayed as 938554. Suppose it gives B 0x1A2B3C4D, which is 439,041,101; modulo 10610^6 this is 41,101, displayed with a leading zero as 041101. The user sees two different numbers and rejects the pairing on both devices. To make the numbers equal, M would have to choose its nonces after seeing the honest devices’ nonces, but the commitments force M to fix at least one nonce before it sees the honest nonce it must match. So M can only hope, and succeeds with probability about 10−610^{-6} per attempt.

Stated precisely

Passive secrecy. Assume (1) the computational Diffie-Hellman problem on P-256 is hard: given points PP, a⋅Pa \cdot P and b⋅Pb \cdot P on the curve, no feasible computation finds a⋅(b⋅P)a \cdot (b \cdot P); (2) each private key is uniformly random, kept secret and used for one pairing only; (3) AES-CMAC behaves as a pseudorandom function §15.1, meaning that, with a secret key, its outputs look random; and (4) each device validates the public key it receives. Then an eavesdropper who records a whole pairing, with any association method, cannot compute DHKey\mathrm{DHKey} or the LTK.

Authentication. Under the same assumptions, an active attacker who must complete pairing with both devices without being detected succeeds in one attempt with probability

The specification classes the keys of Just Works as unauthenticated and the keys of the other three methods as authenticated (out-of-band association only over a channel safe from eavesdropping). LE security mode §7.33 1 level 4 is defined as authenticated LE Secure Connections pairing with encryption using a 128-bit key.

Limits and common mistakes

The name promises key agreement, not authentication. LE Secure Connections with Just Works gives an unauthenticated key: safe from eavesdroppers, open to a man-in-the-middle present during pairing.

Public-key validation is essential. In 2018 Eli Biham and Lior Neumann showed, in an attack they called the fixed coordinate invalid curve attack [279], that implementations which did not check that a received public key lies on P-256 let an active attacker who altered the public keys in transit predict the shared secret in a fraction of attempts. The flaw is listed as CVE-2018-5383 in the Common Vulnerabilities and Exposures (CVE) catalog, and the specification now requires the check.

The specification publishes a fixed debug key pair, private key included, so that test equipment can decrypt traffic. A pairing in which either device uses it has no secrecy, because anyone can compute the shared secret. A device that is not in a debug mode may reject the debug public key.

Later connections are not protected by a new key agreement. Each connection’s session key is computed from the LTK and values sent in the clear, so anyone who later obtains the LTK, for example from a device’s storage, can decrypt every recorded connection that used it.

If either device does not set the SC flag, LE legacy pairing runs instead. A device that must have LE Secure Connections has to refuse legacy pairing itself; this is called Secure Connections Only mode. The key size is still negotiated and can be shorter than 16 bytes.

A reused passkey loses its protection, because each run of passkey entry reveals bits of the passkey; the specification requires a fresh random passkey for every pairing.

Numeric comparison protects only if the user really compares. A user who confirms without looking turns it into Just Works.

Questions answered

Can Secure Connections Just Works resist passive eavesdropping yet lack MITM authentication?

Yes. LE Secure Connections pairing with the Just Works association method resists a passive eavesdropper but gives no protection against an active man-in-the-middle (MITM) attacker.

Key agreement and authentication are separate guarantees: key agreement keeps listeners out, while authentication (numeric comparison, passkey entry or out-of-band association) binds the exchange to the intended device. The specification accordingly classes Just Works keys as unauthenticated.

Related entries: Just Works (§7.22), Numeric comparison (§7.24), MITM attack (§7.26), Key derivation function (KDF) (§5.20), Elliptic-curve Diffie–Hellman (ECDH) (§19.1.5), Authenticated key exchange and transcript binding (§19.1.6), LE legacy pairing (§7.20), Passkey entry (§7.23), Out-of-band (OOB) association (§7.25), Security level (§7.33), Cipher-based MAC (CMAC) (§15.7). Further reading: [18, 279].