Definition
Cross-layer security is reasoning about a security property that depends on several layers of a system at once. In a wireless device these are the radio, the link layer §7.6 that manages packets, the protocol software, the application and storage. The layers handle each event in a fixed order, so a lower layer’s decision fixes what the layers above it ever receive. A property claimed for the whole device holds only if the checks, default settings and assumptions of all layers together cover every path to the protected effect.
The idea
A device’s application contains a policy function that decides which pairing §7.17 requests to accept, and its author adds an exception: accept the older pairing method from one old maintenance tool. The Bluetooth protocol software on the device is configured to accept only the newer, stronger method. That software refuses the older request, and the application’s function is never called. The exception exists in the source code and has no effect. In the other direction, the application rejects a forged update only after the radio has received it, the lower layers have buffered it and the processor has checked it. The rejection is correct, and the time, memory and energy spent on the update are gone.
Both directions teach the same point: a check controls only the events that reach it, and costs incurred below it are already paid. A building with a gate guard, a receptionist and an office manager is a fair picture. A visitor turned away at the gate never meets the receptionist, whatever the receptionist’s rules say, and the office manager’s rules cannot stop a crowd from filling the lobby. The picture fails in one respect: in software, the order of the checks and their defaults are set by code and configuration that the author of the application may never read.
How it works
In a BLE §7.1 (Bluetooth Low Energy) device, an incoming event passes through the layers in this order, and each step can end its journey.
Radio. The radio receives the signal, and the receiving hardware checks each packet’s CRC §4.32 (cyclic redundancy check), an error-detecting code. A packet that fails the check is dropped, and nothing above sees it.
Link Layer. The Link Layer, the part of the chip that controls packets and connections, applies its filter of allowed device addresses if one is configured, acknowledges and resends packets, and on an encrypted link decrypts each packet that is not empty and checks the 4-byte code that detects changes to what it carries. It rejects link procedures it does not support. The Link Layer runs in the Controller, the lower part of a BLE system, which is often a separate chip or separate firmware.
Host. The Host, the protocol software above the Controller, passes the data to L2CAP §7.15 (Logical Link Control and Adaptation Protocol), which directs it to the right protocol. The Security Manager Protocol §7.19, which runs pairing, compares a pairing request with the configured requirements, for example “Secure Connections only” or a minimum key length, and can refuse the request before the application is asked. ATT §7.9 (Attribute Protocol), through which a peer reads and writes the device’s values, checks the security that each value requires, for example “encrypted link required”, and can answer with an error without calling the application’s handler.
Application. The application’s callbacks §14.22, the functions the Host calls when events occur, apply the application’s policy, such as checking the authenticity and version of an update.
Storage and execution. The accepted result is written to storage and later used.
Cross-layer analysis follows one event, or one class of events, through these steps and writes down four facts at each step: what the layer can see, what it decides, what has already been spent when it decides, and which setting controls the decision. The analysis has five parts.
State the property for the whole device as a list of conditions that must all hold. For example: the peer is permitted, the link has the required security level §7.33, the object is authentic, the object’s version is newer than the installed one, and resource use is bounded.
For each condition, find the layer that checks it, and confirm that the check runs before the effect it protects, on the same data that the effect uses.
Record the defaults. A setting that nobody chose is still a setting: build-time options that decide which code is compiled, default security requirements of the protocol software, and values set at run time all take part.
Trace refusals and failures, not only successes, and find every path into the protected effect. Complete mediation §1.16, the requirement that every access passes the check, fails if one path skips it.
Reuse a lower layer’s guarantee only where its premises hold. Link encryption protects the bytes between two radios; it says nothing about who created an object that one of those radios forwards.
Worked example
Three events reach a device. Its Host accepts only the Secure Connections pairing method, and its update characteristic, the value that peers write to deliver updates, requires an encrypted link.
Event 1, a pairing request for the older legacy method. Radio: passes. Link Layer: passes, because pairing messages are ordinary data to it. Host: the Security Manager Protocol compares the request with the requirement and answers with a Pairing Failed message. Application: its pairing callback is never called. The event is decided at step 3 of 5, and an exception written in the application cannot take effect.
Event 2, a write to the update characteristic on an unencrypted link. Steps 1 and 2 pass. At step 3, ATT finds that the value needs an encrypted link and answers with an error. The application’s write handler is never called. The event is decided at step 3.
Event 3, a forged 732-byte update on an encrypted link. With the packet sizes the two devices agreed on, each write carries 244 bytes of update data, so the update needs writes. Steps 1 to 3 pass all three writes: the link is encrypted, the peer may write, and the bytes are well formed. At step 4 the application checks the update’s authentication §1.6 code over all 732 bytes and rejects the update. The event is decided at step 4, after the device has received three packets, stored 732 bytes and computed one authentication code.
For a property of the whole device such as “only authentic updates are installed, and no peer can make the device hold unbounded memory”, the three events show where each part must be enforced. Authenticity is enforced at step 4. A bound on memory must be enforced at step 3 or below, because by step 4 the memory is already in use.
Stated precisely
Number the layers from 1, the lowest, to , the highest, and let be the set of events that layer accepts and passes upward. Layer sees exactly the events in , the events that every lower layer accepted, and the device acts only on events in . Two consequences follow. A policy at layer can narrow what lower layers passed, but it cannot accept an event that a lower layer rejected, unless that layer offers a setting or a callback for the decision. And the work that layers 1 to do for an event is spent whether or not layer rejects it.
Write the property for the whole device as a conjunction , where each is one condition and means and. A check establishes only its own condition, and only if what the check takes for granted is true, such as the secrecy of the key it uses. The device enforces for an effect when every path from an input to passes a check of every , before , on the data that uses. Passing the checks of and says nothing about : with outcomes true, true and false, the conjunction is false, and the event must be rejected.
This model treats each layer as a filter. Real layers also change events: they join fragments, decrypt bytes, and create events of their own, such as a disconnection after a timeout §9.34. Each change is one more place where an assumption of a higher layer can stop being true.
Limits and common mistakes
A policy hook in the source code is not evidence that the policy is enforced. An earlier layer can reject the event first, a different path can reach the effect without passing the hook, or the effect can happen outside the hook’s scope.
Tracing one successful event does not show complete mediation. Refusal and failure paths, and every configuration the device ships with, must be traced too.
Defaults change. A new version of the protocol software can change a default security requirement, and with it which events reach the application.
The application often cannot see what lower layers decided. If the Host does not report which pairing method was used, the application cannot tell an authenticated link from one created with Just Works §7.22 pairing, which gives no protection against an attacker who relays and alters the pairing messages between the two devices.
An application’s checks cannot provide properties that live below it. They cannot stop radio jamming, cannot prevent a crash caused by a malformed packet in the Controller’s own code, and cannot restore storage that an attacker rolled back to an older state. In 2020 a set of flaws named SweynTooth showed that malformed Link Layer packets could crash or deadlock §9.14 the Link Layer software of BLE chips from several vendors [274]. Each of these properties needs its own mechanism and its own stated assumptions.
A lower layer’s guarantee does not carry upward unchanged. Link encryption shows that bytes came from the paired peer device. It does not show that the object those bytes carry is authentic; that needs end-to-end security §1.34, a check by the final receiver of a code made by the object’s creator, as the Channel confidentiality versus object authenticity §7.34 entry explains.
Questions answered
Can lower-layer defaults reject an event before higher-layer policy sees it?
Yes, lower-layer defaults can reject an event before the higher-layer policy sees it. Each event passes through the layers from the bottom up, and a lower layer that rejects it, by an explicit setting or by a default that nobody chose, ends its journey there: the higher-layer policy is never called and has no chance to accept it. In a BLE (Bluetooth Low Energy) device, for example, protocol software configured to accept only the Secure Connections pairing method refuses an older-method pairing request before the application’s pairing callback runs. In the same way, the Attribute Protocol refuses a write that needs an encrypted link without calling the application’s write handler.
To know which layer decides a given event, trace that event through the actual protocol software with its actual configuration, defaults included, and test the refusal paths as well as the successful one. A policy function in the source code and one trace of an accepted event do not show that the policy sees every event.
Related entries: BLE Controller and Host (§7.4), Link Layer (§7.6), End-to-end security (§1.34), Jamming versus protocol DoS (§7.40), Complete mediation (§1.16), Channel confidentiality versus object authenticity (§7.34), Security Manager Protocol (SMP) (§7.19). Further reading: [18, 91, 274].