Question
Why might an application authenticate an object even over an encrypted, authenticated BLE §7.1 link?
Short answer
An application authenticates the object because the link cannot say who created it. An encrypted, authenticated BLE (Bluetooth Low Energy) link proves only that the bytes came from the device at the other end of this radio link and were not read or changed in transit. The object may have been created elsewhere and passed through a server, a phone app or a gateway. A tag that the author computes over the object, such as a digital signature §5.14, lets the final receiver check the origin, whatever path the object took.
Terms in the question
BLE: Bluetooth Low Energy, a short-range, low-power radio standard. A link is the connection between two BLE devices.
Encrypted link: pairing is the procedure in which two BLE devices create shared keys. Afterwards the link layer §7.6, the part of each device that sends and receives packets over the radio, encrypts every packet with a key that only the two devices hold. It also appends a 4-byte tag that Bluetooth calls the message integrity §1.9 check (MIC), and the receiver rejects a packet whose tag does not match.
Authenticated link: the pairing used a method that resists a man-in-the-middle §7.26 (MITM) attacker, an attacker who sits between the two devices and relays their traffic. An example is asking the user to confirm that both devices show the same six-digit number. Each device then knows that it shares its keys with the device the user confirmed.
Object: a self-contained piece of data that the application acts on as a whole, such as a firmware image (the program a device runs), a configuration file, a policy or a command. An object has an author, the party that created it, and it can be copied, stored and forwarded.
Authenticate an object: check a tag that the author computed over the object’s bytes with the author’s key. With a digital signature, the author signs with a private key, and receivers check with the matching public key. With a MAC (message authentication code §5.7), the author and the receiver share one secret key.
Full answer
Step 1: what the link establishes. For each packet, link encryption gives three facts. A holder of the link key sent the packet, and after pairing that means the device at the other end of this link. Nobody without the key read the packet on the air. Nobody without the key changed it on the air. These facts hold only between the two radios and only while the packet travels. The receiving device removes the protection and hands plain bytes to the application. The link key identifies a device, not a person, an app or a server behind that device.
Step 2: the author of the object is usually not the link peer. A firmware update is written and built by its publisher, such as the manufacturer, placed on a server, downloaded by a phone app and only then sent over BLE. The device at the other end of the link is the phone, or a gateway, a device that forwards data from one network to another. The link proves that the phone sent these bytes. Whether the phone sent the publisher’s bytes unchanged is a separate question, and only the publisher has authority over what the object says. Protection that the original author applies and the final receiver checks, however many systems carry the data in between, is end-to-end security §1.34. Protection of each link separately is called hop-by-hop, and every relay in a hop-by-hop chain holds the data unprotected and could change it.
Step 3: every legitimate relay is a place to attack. If the server, the phone app or the gateway is compromised, the attacker controls a legitimate, paired endpoint. A modified object then arrives over a correctly authenticated link, and every MIC verifies, because the attacker’s endpoint computed it. The endpoint can also be shared. On Android, for example, a bond, the set of keys stored after pairing, belongs to the phone rather than to one app, so another app that holds the Bluetooth permissions can send data over the same encrypted link. An object tag defeats all of these cases: a relay that changes even one byte of the object cannot compute a valid tag for the new bytes without the author’s key.
Step 4: the object outlives the link. The device writes the object to flash memory §6.6 and may use it at every start for months. Link protection ended when the last packet arrived and says nothing about the stored bytes. An object tag stays with the object, so the device can check it when it installs the object and again before each use, as secure boot §6.31, the check of the firmware at every start, does for firmware.
Step 5: the object tag can cover facts that the link cannot. Link encryption numbers the packets of one connection, so a recorded packet replayed into the same connection is rejected. It cannot recognize an old object sent afresh over a new connection, such as an old firmware image with a known flaw that still carries its author’s valid tag. To refuse that image, the authenticated bytes of the object must include a version number, which the device compares with the highest version it has accepted so far, its version high-water mark §8.27. The authenticated bytes should also name the device type and the purpose of the object, so that a valid object made for one device or one purpose is refused by another.
Step 6: what each check leaves open. Object authentication §1.6 does not make the link protection redundant. The link still hides the object from eavesdroppers, since a signature hides nothing; it keeps devices that never paired away from the receiver’s parser; and it protects commands that are not objects. Neither check decides whether this author may make this change on this device, which is authorization §1.7, or whether the object is safe to use, which is validation. The link answers “which device sent these bytes over this link?”, while the application needs the answer to “who created this object, and may that party ask for this?”
Worked example
Gateway G is paired with device D by numeric comparison §7.24, an authenticated method. Publisher P, the manufacturer, signs each firmware image with its private key. D stores P’s public key and the highest firmware version it has accepted, 2.1. The signed bytes are a header, which holds the version and the device type, followed by the image.
Honest delivery. P publishes version 2.2: an image of 120,000 bytes and a 64-byte signature. G forwards both to D in many packets, and the 4-byte MIC of every packet verifies at D. D then checks P’s signature over the header and the image with P’s public key, and the signature is valid. The version comparison holds, so D installs the image and raises its stored version to 2.2.
A modified object. An attacker takes control of G. G changes 1 of the 120,000 bytes of version 2.2, for example to switch off a safety check, and forwards the result. Every MIC verifies, because G computed each MIC with the link key. The signature check fails, because P signed the original bytes, and G cannot sign the changed bytes without P’s private key. D refuses the image. Without the object check, D would have installed it.
An old object. G sends version 2.0, an authentic image with a known flaw. Every MIC verifies, and P’s signature on version 2.0 is valid. The version comparison fails, so D refuses the image.
In all three cases every link check passed. Only the object checks, the signature and the version inside the signed bytes, told the three cases apart.
Follow-up questions and limits
Why not trust the gateway, since its link is authenticated? Then every device trusts every relay on every path, and one compromised phone app or gateway can install anything on every device it serves. With object authentication, the devices trust one key, the publisher’s, and the relays need no trust for the integrity of the object.
If a relay decrypts the link, can it read the object? Yes. Every hop-by-hop relay sees the object unencrypted. If the content must stay secret from relays, the publisher must also encrypt the object for the final device, end to end.
Does a valid signature show that the object was installed? No. It shows who created the object. Whether the device installed and started the object is a separate fact, which only a report from the device, preferably authenticated with the device’s own key, can establish.
This answer does not cover how the publisher protects, replaces or revokes its signing key, or how the device stores the publisher’s public key so that an attacker cannot replace it.
Fullest treatment: Channel confidentiality versus object authenticity (§7.34).
Related entries: End-to-end security (§1.34), Authentication coverage (§5.41), Authorization (§1.7), Cross-layer security (§7.38).