Full name: Bluetooth Low Energy §7.1 State-Aware Security Framework. The paper prints the name as “Bluetooth LE State-aWAre securiTy framework” to show which letters it takes.
What it is
BlueSWAT is a security framework for devices that use Bluetooth Low Energy (BLE), a low-power radio protocol. Xijia Che, Yi He, Xuewei Feng, Kun Sun, Ke Xu and Qi Li published it in 2024 at the Conference on Computer and Communications Security (CCS). It targets session-based attacks, in which earlier packets prepare the conditions that a later packet exploits, while each packet looks legitimate on its own. BlueSWAT records inside the device what has happened on each connection, and ends a connection whose sequence of events matches a known attack.
Basis of this account
This account rests on the authors’ preprint, the version they posted on the public arXiv server before the conference: arXiv:2405.17987, version 1 of 28 May 2024. All 17 pages were read: Sections 1 to 10 and Appendices A to E. The peer-reviewed paper is in the proceedings of CCS 2024, a conference of the Association for Computing Machinery, pages 2087 to 2101 (https://doi.org/10.1145/3658644.3670397). Section 4.4 and Table 4 of the published paper were checked in the first author’s copy (https://www.ray-che.com/assets/papers/3658644.3670397.pdf). They confirm the live delivery mechanism and the reported mitigation counts of 35 out of 46 session-based cases and 53 out of 55 packet-based cases. Other numbers and appendix references below follow the preprint. The key sizes that Bluetooth permits were checked in the Security Manager part of the Bluetooth Core Specification, versions 5.4 and 6.2. Nothing was run or measured for this account.
What the paper claims
The authors make these claims.
Novelty. They call BlueSWAT “the first state-aware security framework against BLE session-based attacks”.
Updates without a restart. A detection rule is compiled to eBPF §2.1 (extended Berkeley Packet Filter) bytecode §2.4, that is, to instructions for a virtual machine §2.3, a small program on the device that executes them. The rule reaches the device over BLE. The authors state that adding a rule needs no rebuild of the device’s software and no reboot, and that one rule serves devices with different processors and different BLE software. They ran BlueSWAT on 5 devices and inserted 6 to 9 lines of code into the BLE software of each.
Effectiveness. From 117 BLE vulnerabilities collected up to November 2023 they evaluated 101: 46 session-based and 55 packet-based, where a packet-based attack needs only one crafted packet. They report that BlueSWAT mitigates 35 of the 46 (76.1%) and 53 of the 55 (96.4%). For LBM (Linux (e)BPF Modules), an earlier framework that inspects packets one at a time, they report 0 of 46 and 31 of 55 (56.4%).
No false alerts. They state that BlueSWAT raises no false alert (the paper’s term is false positive §1.22) on the vulnerabilities it mitigates, because an alert needs the complete attack sequence.
Low cost. On an nRF52840 §6.4 development board §6.5 from Nordic Semiconductor they report about 12.8 kilobytes of flash memory §6.6 (permanent program storage) and 720 bytes of RAM for the framework, 137.2 bytes of flash memory per rule on average, and about 1.2 microseconds on average to check a received packet against one rule.
How it works
BlueSWAT is added to the BLE software of the device. It has three parts.
Hooks. A hook is a short call inserted into existing code. The hooks sit where the BLE software receives and sends packets of the Link Layer §7.6 (LL), the protocol layer directly above the radio, and where it handles packets of the Security Manager Protocol (SMP) §7.19, which negotiates encryption keys. The hooks turn packets into events.
A finite state machine §8.33 (FSM). An FSM is a model with a fixed set of states and rules for moving between them. The FSM of BlueSWAT has five benign states that follow a normal connection (Standby, Discovery, LL Connection, Key Sharing, Data Exchange) and four exploiting states that mean an attack was recognized (Discovery Error, Connection Break, Pairing Exploitation, Encryption Failure). BlueSWAT also stores a few values from earlier benign connections, such as the address of the other device and the key size used with it.
Transition rules. Each rule is a small eBPF program attached to one state and one event. It reads the event, the state and the stored values, and returns pass or reject.
For every event, BlueSWAT runs the rules attached to the current state and that event. If a rule rejects, the FSM enters an exploiting state: BlueSWAT raises an alert, ends the connection and returns the FSM to Standby. Otherwise the FSM takes the benign transition, but only once the device’s own reply shows that the BLE software accepted the packet. The rules run in an eBPF virtual machine built on the uBPF §2.16 (userspace eBPF) library. The authors state that the framework also guards the device against a faulty rule: it checks the instructions and the number of loop iterations of a rule and prevents memory writes outside the permitted bounds. New rules arrive through a BLE service added for this purpose.
Worked example
The paper’s own example is the KNOB (Key Negotiation of Bluetooth) attack, a downgrade attack §1.27: it makes two devices agree on a much shorter encryption key than both support. The phone, lock and sensor are invented here; the steps and values are the paper’s. Pairing is the BLE procedure in which two devices agree on an encryption key. A phone and a door lock paired earlier with an encryption key size §7.27 of 16 bytes, which is bits. BlueSWAT on the lock stored the phone’s address and the size 16. Later an attacker in radio range pretends to be the phone, reconnects, and sends the packet that starts pairing, a Pairing Request, whose field Maximum Encryption Key Size is set to 7 bytes, which is bits. The Bluetooth specification permits sizes from 7 to 16 bytes, so the request is valid. If the lock accepted it, the attacker could, as the paper describes, record the encrypted traffic and find the key by trying at most candidates, about .
On the lock the FSM has moved from Standby through Discovery to LL Connection, and the address matches a stored record. The Pairing Request triggers a rule that compares the requested size with the stored one. Since , the rule rejects, the FSM enters Pairing Exploitation, and BlueSWAT ends the connection.
A different history ends in the same packet. A sensor that supports only 7-byte keys pairs with the lock for the first time. No earlier size is stored, so the rule passes. A filter that sees only the current packet must treat both histories alike: it blocks the sensor too, or it lets the attack through.
What this account does not establish
The results are the authors’ own, and this account did not reproduce them. The preprint describes reproducing three attacks on the five devices. For the other vulnerabilities, and for the LBM numbers, it does not say how each result was obtained.
The statement about false alerts is argued from the design. The preprint reports no count of alerts on legitimate traffic.
The preprint is not consistent in every detail. In its Table 5 the counts for LBM in the separate categories of packet-based vulnerabilities add up to 30 of 55, while the total row and the text give 31 of 55. The sample rule printed in its Appendix D rejects a pairing when the field SMP_ENC_SIZE is larger than the field SMP_ENC_SIZE_PREV. If these names mean the new and the previous key size, that is the opposite of the comparison that the text describes. The worked example above follows the text.
BlueSWAT does not fully mitigate 13 of the 101 vulnerabilities. The authors explain that the affected devices lack encryption or authentication §1.6, or handle reconnection or access permissions wrongly, and that a monitor cannot supply a missing function.
A rule recognizes only the sequence it encodes, and the authors leave it to the vendor to make each rule match its attack. The KNOB rule needs a stored earlier value: by the paper’s description a first pairing with a short key is allowed, so an attacker who is present at the first pairing is not detected.
The preprint does not describe how a device checks who sent a new rule.
The threat model §1.2 is an attacker in radio range who can listen, inject packets, and jam, that is, block reception by transmitting an interfering signal. Attacks on the radio signal itself and on the application above BLE are out of scope.
Questions answered
Why cannot a stateless predicate recognize every session attack?
A stateless predicate cannot recognize every session attack because it decides from the current packet alone, while a session attack is spread over several packets and can differ from legitimate use only in what happened earlier. A stateless predicate is a rule that maps the current packet to allow or block and remembers nothing between packets. If the same packet must be allowed after one history and blocked after another, the predicate gives one answer for both and is wrong for one of them. For example, in Bluetooth Low Energy (BLE) a request to set up encryption with a 7-byte key is legitimate from a device that connects for the first time. The same request signals a downgrade attack, an attempt to force weaker protection than was used before, when it claims to come from a device that used a 16-byte key before.
A monitor that keeps state can separate the two cases, on three conditions. It records the earlier fact that matters, here the key size last used with this device address. The record is tied to the right device, starts from a defined initial value, changes only on events that really happened, and is deliberately kept or cleared when the connection ends or the device restarts. And the monitor sits where it observes the deciding event at all: more states do not help if that event never reaches it. BlueSWAT (Che and others, 2024), a security framework for BLE devices, is built on this idea.
Related entries: Protocol state machine (§7.37), Finite-state machine (§8.33), Downgrade attack (§1.27), Encryption key size (§7.27), OASIS: placing an IDS inside a BLE controller (§21.2), RapidPatch: virtual patches and trigger contracts (§21.5). Further reading: [3, 18, 203].