Defeating Bluetooth Low Energy 5 PRNG for fun and jamming
Damien Cauquil (Head of Research and Development · Digital Security)
BruCON 0x0B · Day 2
Overview
In this compelling talk at BruCON, Damien Cauquil, Head of Research and Development at Digital Security and the primary developer of BtleJack, unveiled a critical vulnerability in the Bluetooth Low Energy (BLE) 5 protocol. Specifically, his research targets the new Pseudo-Random Number Generator (PRNG) used in BLE 5's Channel Selection Algorithm (CSA) #2, demonstrating how its predictable nature can be exploited to sniff, jam, and hijack BLE 5 connections. This discovery challenges the perceived robustness of BLE 5's improved coexistence mechanisms, revealing that design choices aimed at reliability can inadvertently create security weaknesses.

Key moments
- 0:00 BLE 5 features and existing attack landscape
- 11:30 BLE 5's new PRNG-based channel hopping mechanism
- 18:00 Critical flaws in BLE 5's pseudo-random number generator
- 22:00 Sieve attack: recovering the PRNG counter value
- 34:00 Practical demo: sniffing a BLE 5 connection
- 35:30 Practical demo: jamming a BLE 5 connection
- 39:30 Conclusion: PRNG flaws and developer security advice
Defeating Bluetooth Low Energy 5 PRNG for fun and jamming
Speakers: Damien Cauquil (Head of Research and Development, Digital Security)
Conference: BruCON
YouTube: https://www.youtube.com/watch?v=rtaSCqngvqU
Overview
In this compelling talk at BruCON, Damien Cauquil, Head of Research and Development at Digital Security and the primary developer of BtleJack, unveiled a critical vulnerability in the Bluetooth Low Energy (BLE) 5 protocol. Specifically, his research targets the new Pseudo-Random Number Generator (PRNG) used in BLE 5's Channel Selection Algorithm (CSA) #2, demonstrating how its predictable nature can be exploited to sniff, jam, and hijack BLE 5 connections. This discovery challenges the perceived robustness of BLE 5's improved coexistence mechanisms, revealing that design choices aimed at reliability can inadvertently create security weaknesses.
Cauquil's presentation meticulously details the technical underpinnings of his attack, from analyzing the BLE 5 specification to implementing a practical proof-of-concept. He exposes how the publicly derivable seed and observable output of the PRNG allow an attacker to deduce the internal state of a connection, subsequently enabling malicious activities that were thought to be mitigated in the latest BLE iteration. The implications are significant for a vast array of IoT devices, from wearables to industrial sensors, that rely on BLE 5 for secure and reliable communication.
The talk serves as a crucial reminder for developers and security professionals alike: while new protocol versions often introduce performance enhancements and improved reliability, security must remain a primary concern, especially when custom cryptographic primitives are involved. Cauquil's work underscores the adage "don't roll your own crypto" and highlights the ongoing need for robust security features, even in mechanisms designed purely for operational efficiency rather than explicit security.
Background
▶ Watch: BLE 5 features and existing attack landscape (0:00)
Bluetooth Low Energy (BLE), initially introduced in 2010 as Bluetooth Smart alongside the Bluetooth 4.0 specification, has rapidly evolved through versions 4.1 (2013), 4.2 (2014), 5.0 (2016), and 5.1 (2019). Each iteration has brought enhancements, including improved security mechanisms like Elliptic Curve Diffie-Hellman (ECDH) for out-of-band key exchange in 4.2, and built-in secure connections providing encryption and authentication. However, the 2.4 GHz band, where BLE operates, is notoriously crowded, leading to interference and connection instability—a problem known as coexistence.
Prior to BLE 5, existing attacks against BLE 4.x connections primarily included sniffing, jamming, and hijacking. Sniffing, which captures communication to extract secrets and data, was historically possible with specialized tools like Ubertooth One or through custom firmware on devices like the Micro:bit (featuring a Nordic nRF51822 chip). Recently, a tool called Sniffle extended sniffing capabilities to new BLE 5 connections by capturing the initial connection request. Jamming involves injecting packets to disrupt an existing connection, often by exploiting the supervision timeout feature. Hijacking takes this a step further, jamming the legitimate master device and then taking its place to control the slave device. These attacks typically required specific hardware capable of capturing and injecting packets.
BLE 5 introduced several significant features, including increased throughput (up to 2 Mbps with the 2M PHY), extended range (up to 240 meters with the Coded PHY at 125 kbps, or 100 meters at 500 kbps), and crucially, improved coexistence. This coexistence enhancement is largely attributed to a new Channel Selection Algorithm (CSA) #2. The previous algorithm, CSA #1, was a simple, predictable mechanism: (previous_channel + increment) % 37. While easy to implement, its deterministic nature made it susceptible to collisions in crowded environments. CSA #2, in contrast, was designed to be more "random" using a PRNG, making channel hopping less predictable and thus improving reliability in congested spectrums. This improved channel hopping was intended solely for coexistence, not as a security feature, a distinction that becomes critical in Cauquil's analysis.
Key Findings
▶ Watch: Critical flaws in BLE 5's pseudo-random number generator (18:00)
Damien Cauquil's core discovery is that the Pseudo-Random Number Generator (PRNG) implemented in Bluetooth Low Energy (BLE) 5 for its Channel Selection Algorithm (CSA) #2 is fundamentally flawed and predictable, despite its design intent to improve coexistence through more "random" channel hopping. This predictability allows an attacker to synchronize with, sniff, jam, and potentially hijack BLE 5 connections.
The key findings can be summarized as follows:
- "Don't Roll Your Own Crypto" Violation: The BLE 5 PRNG is a custom-designed algorithm, which cryptographers widely caution against due to the high likelihood of introducing subtle vulnerabilities. Cauquil, along with cryptographer Matthew Green, quickly identified potential issues upon reviewing the specifications.
- Publicly Known Seed: The PRNG uses a Channel Identifier as its seed. Crucially, this Channel Identifier is derived directly from the Access Address—a 32-bit value that identifies a link between two devices and is publicly broadcasted during connection establishment. Specifically, it's a 16-bit value computed by XORing bits 0-15 and 16-31 of the Access Address. This means the PRNG's seed is not secret.
- Predictable Sequence for a Given Seed: For a given Channel Identifier (seed), the PRNG generates a fixed sequence of 65,536 channel numbers. This sequence is entirely deterministic. If an attacker knows the seed and the current position (counter value) within this sequence, they can predict all future channels.
- Recoverable Internal State (Counter): While the internal counter (representing the current position in the sequence) is not directly exposed, Cauquil demonstrates a method to deduce it. By observing the time between packets on different channels and knowing the Hop Interval (the time a device spends on a channel), an attacker can use a "sieve" attack combined with pattern matching to narrow down and ultimately identify the exact counter value. Simulations showed a 95% success rate with just 5-6 measurements, reaching 100% with 10 measures, with a maximum recovery time of 8 seconds.
- Re-enabling Jamming and Hijacking for BLE 5: Because previous jamming and hijacking attacks relied on the simpler CSA #1, they were ineffective against BLE 5's CSA #2. Cauquil's discovery effectively bypasses this mitigation, re-enabling these types of attacks against the latest BLE standard by allowing an attacker to synchronize with the connection's channel hopping pattern.
These findings highlight a critical oversight in the BLE 5 design: prioritizing coexistence and ease of implementation over robust cryptographic design for a mechanism that, while not explicitly "security-focused," has profound security implications when predictable.
Technical Deep Dive
▶ Watch: Sieve attack: recovering the PRNG counter value (22:00)
The crux of Damien Cauquil's research lies in the analysis and exploitation of the Bluetooth Low Energy (BLE) 5 Channel Selection Algorithm #2 (CSA #2). To understand the vulnerability, it's essential to contrast it with its predecessor and delve into the specifics of the new PRNG.
Channel Selection Algorithm #1 (CSA #1)
The original CSA #1, used in BLE 4.x, was a simple deterministic algorithm: next_channel = (previous_channel + increment) % 37. The increment value was set by the master device during connection establishment. This algorithm selected channels from a pool of 37 data channels. While straightforward to implement, its predictability made it vulnerable to collisions in crowded environments and allowed attackers to easily follow connections once the increment was known (e.g., from a connection request).
Channel Selection Algorithm #2 (CSA #2)
BLE 5 introduced CSA #2 to improve coexistence and reliability by making channel hopping appear more "random." Devices supporting CSA #2 signal this by setting the CH_SEL bit to '1' in their advertising packets. Instead of a simple arithmetic progression, CSA #2 employs a Pseudo-Random Number Generator (PRNG) to determine the next channel. This PRNG is designed for tiny devices with limited computational power, making it simple but, as Cauquil discovered, also weak.
The PRNG takes two primary inputs:
- Counter: An internal, incrementing value representing the current hop number.
- Channel Identifier: A 16-bit seed value derived from the Access Address. The Access Address is a 32-bit value broadcasted publicly during connection initiation, identifying the link between two devices. The Channel Identifier is computed by XORing the lower 16 bits (bits 0-15) with the upper 16 bits (bits 16-31) of the Access Address. This is a critical point: the PRNG's seed is publicly known or easily computable.
The PRNG itself is a three-step Multiplier-Additive-Permutation (MAP) routine, as described in the BLE 5 specification:
- XOR Permutation:
Value = (Counter XOR Channel_Identifier) - Multiply-Add:
Value = (Value * 0x6ACF + 0x2A) % 65536(This is a simplified representation; the actual spec uses specific bitwise operations and shifts to achieve this effect within a 16-bit register). - Another XOR Permutation:
Output = (Value XOR Channel_Identifier)
This routine generates a sequence of 65,536 16-bit pseudo-random numbers, which are then mapped to the available data channels. For a given Channel Identifier, this sequence is entirely fixed and repeatable.
The Attack Methodology: Recovering the Counter
The core of Cauquil's attack is to deduce the internal Counter value at a specific time, given that the Channel Identifier is known. If the counter is known, the attacker can predict the entire channel hopping sequence and thus synchronize with the connection.
The attacker, as an external observer, has limited information:
- Packet Reception: The ability to detect if a packet is received on a specific channel at a given time.
- Time Differences: The ability to measure the time elapsed between packets observed on different channels.
The attack proceeds in several steps:
- Determine the Hop Interval: The Hop Interval is the fixed duration a device spends on a particular channel before hopping to the next. This value is crucial for calculating the counter progression. By observing multiple packet receptions on different channels and measuring the time differences between them, the attacker can use the Greatest Common Divisor (GCD) of these time differences to accurately deduce the Hop Interval. For instance, if packets are observed on channel A, then channel B after
T1ms, and then channel C afterT2ms from B, thenT1andT2must be multiples of the Hop Interval. The GCD ofT1, T2, ...will reveal the Hop Interval. Cauquil's implementation demonstrated successful GCD computation.
- Pre-computation of Channel Sequences: Since the Channel Identifier is known, the attacker can pre-compute all 65,536 possible channel sequences for every possible starting counter value. Each sequence is simply the deterministic output of the PRNG for incrementing counter values, starting from a given initial counter.
- Sieve Attack (Pattern Matching): With the Hop Interval determined and the channel sequences pre-computed, the attacker listens for a series of incoming packets on different channels. This forms an observed "pattern" of channel hops over time.
- The initial approach was a "sieve" method: generate all 65,536 candidates for the counter. For each candidate, predict the next channel based on the current observed channel and the Hop Interval. If the predicted channel doesn't match the observed channel at the correct time, eliminate the candidate. Repeat this process until only a single candidate (the correct counter) remains.
- Cauquil initially found this sieve approach computationally intensive for the small hardware he was using, leading to synchronization delays (e.g., being 13 hops late).
- He refined this into a pattern matching algorithm. Instead of iteratively eliminating candidates, the attacker takes several consecutive measurements of observed channels. This observed pattern is then compared against the pre-computed sequences. A sequence that matches the observed pattern for a given
Countervalue reveals the correct internal state. - Simulations showed remarkable efficiency: just 5-6 measures yielded a 95% success rate, while 10 measures achieved 100% success. The maximum time required to recover the counter was 8 seconds.
- Synchronization and Exploitation: Once the correct counter value is identified, the attacker knows the exact state of the PRNG and can predict all future channel hops. This allows full synchronization with the BLE 5 connection, enabling:
- Sniffing: Capturing all packets on the correct channels.
- Jamming: Injecting disruptive packets precisely when the target devices are listening on a specific channel.
- Hijacking: Disconnecting the legitimate master and taking its place, maintaining the connection with the slave.
This detailed technical breakdown reveals that the simplicity of the BLE 5 PRNG, intended for low-power devices, became its ultimate undoing, proving that even "non-security" features can introduce critical security vulnerabilities if not designed with cryptographic rigor.
Demo / Proof of Concept
▶ Watch: Practical demo: jamming a BLE 5 connection (35:30)
Damien Cauquil demonstrated the practical feasibility of his attack using a setup mirroring real-world BLE 5 deployments, albeit with development kits due to the nascent availability of true BLE 5 compatible end-user devices at the time of the talk.
Setup and Tools
- Hardware:
- Two Nordic nRF52840 Development Boards: These were used as the master and slave devices. The nRF52840 chip is crucial as it supports the new BLE 5 features, including CSA #2 and the 2 Mbps/Coded PHYs, which were not fully supported by older chips like the nRF51822.
- Custom Firmware: The boards were flashed with firmware from the Nordic SDK, configured to use Channel Selection Algorithm #2 (CSA #2), specifically for testing purposes.
- NRF52840 USB Dongle: This dongle, acting as the attacker's hardware, was capable of capturing and injecting BLE 5 packets.
- Software:
- BtleJack (Modified Version): Cauquil's own open-source Bluetooth Low Energy Swiss Army knife tool, BtleJack, was significantly modified to implement the new attack techniques. The modified version, slated for release as BtleJack 2.0, included:
- Functionality to compute the Hop Interval using the GCD-based technique.
- The pattern matching algorithm to recover the internal PRNG counter value.
- Capabilities to map and follow channels generated by CSA #2.
Demonstration Steps
Cauquil walked the audience through the attack process, primarily using pre-recorded video segments to condense the time-consuming computations into an impactful demonstration:
- Hop Interval Recovery:
- The first step involved the modified BtleJack listening to an active BLE 5 connection between the two nRF52840 dev boards.
- By capturing multiple packets and measuring the time differences between their receptions on various channels, BtleJack computed the GCD of these time differences.
- The demonstration successfully showed BtleJack deducing the correct Hop Interval value, confirming the viability of this initial stage.
- Counter Value Recovery and Sniffing:
- Following the Hop Interval determination, BtleJack proceeded to implement the pattern matching algorithm to deduce the internal PRNG counter value.
- This involved listening for a series of channel hops and comparing the observed pattern against pre-computed sequences. The video showed BtleJack processing the data, and after a few seconds (edited for brevity, but noted to take up to 8 seconds in simulations), it successfully identified the correct counter.
- Once the counter was recovered, BtleJack was fully synchronized with the BLE 5 connection. The demonstration then showed BtleJack actively sniffing and capturing data packets from the connection, proving that the channel hopping could be accurately predicted and followed. Cauquil noted that he pre-specified the channel map in the demo to speed up the video, but the underlying mechanism was fully functional.
- Jamming Attack:
- To demonstrate jamming, Cauquil set up a scenario where one nRF52840 board (slave) had an LED connected. When the connection between the master and slave was lost, the LED would illuminate.
- With BtleJack synchronized to the connection, it began injecting disruptive packets.
- The video showed the LED on the slave device turning on, indicating that the BLE 5 connection had been successfully jammed and lost. The master device also detected the disconnection and attempted to re-establish, showcasing the effectiveness of the attack in disrupting BLE 5 communications.
- Hijacking (Conceptual, Not Live Demo):
- Cauquil explained that a hijacking attack would follow naturally from successful jamming and synchronization. The principle involves jamming the legitimate master, then BtleJack (as the attacker) taking its place to maintain the connection with the slave.
- However, he encountered a practical issue with the specific firmware on the nRF52840 dev boards: they had a very short timeout for detecting lost connections. This meant the slave device would quickly disconnect and initiate a new connection before the attacker could fully assume the master's role.
- Despite this, Cauquil confidently stated that the hijacking attack would work on devices with more typical, exploitable timeouts, as the core mechanism of synchronization and disruption was proven. He emphasized the need for real-world BLE 5 devices to fully demonstrate this specific attack vector.
The demo conclusively proved that the theoretical vulnerability in the BLE 5 PRNG could be translated into practical exploits for sniffing and jamming, with hijacking being a logical extension, given suitable target device firmware. The release of BtleJack 2.0 was announced, allowing others to replicate and further test these findings.
Defensive Implications
▶ Watch: Conclusion: PRNG flaws and developer security advice (39:30)
Damien Cauquil's research into the BLE 5 PRNG carries significant defensive implications for developers, manufacturers, and users of Bluetooth Low Energy devices. The core message is clear: the improved coexistence features of BLE 5 do not equate to improved security, and developers must actively implement the protocol's built-in security mechanisms.
Here are the key defensive implications:
- Do Not Rely on "Coexistence" for Security: The BLE 5 PRNG and CSA #2 were designed solely to enhance device coexistence in crowded 2.4 GHz environments. They were never intended as a security feature. Developers should not assume that the increased "randomness" of channel hopping provides any cryptographic protection against eavesdropping or tampering. This highlights a common pitfall in protocol design where operational improvements are mistaken for security enhancements.
- Mandate Secure Connections: The most critical takeaway for developers is the absolute necessity of using the secure connection features provided by the BLE protocol itself. This includes:
- Encryption: Protecting data confidentiality.
- Authentication: Verifying the identity of connected devices.
- Key Exchange Mechanisms: Utilizing robust methods like ECDH to establish secure session keys.
Cauquil laments that, based on his observations, approximately 90% of BLE devices still use unprotected or unsecure connections. This widespread negligence makes devices vulnerable to trivial sniffing, jamming, and hijacking attacks, regardless of the BLE version or channel selection algorithm.
- Assume Channel Hopping is Predictable: Defenders should operate under the assumption that an attacker can predict the channel hopping sequence of any BLE 5 connection if they can observe initial connection parameters (like the Access Address) and a few subsequent hops. This means that the channel selection algorithm offers no protection against synchronized attacks.
- Implement Robust Timeout Mechanisms: While not a direct countermeasure to the PRNG vulnerability, the issue Cauquil faced with hijacking (due to short device timeouts) suggests that device firmware should be carefully designed. While overly long timeouts can create an exploitation window for hijacking, extremely short ones might lead to poor user experience or connection instability in legitimate scenarios. A balanced and secure state management is necessary.
- Audit Custom Cryptographic Implementations: The BLE 5 PRNG is a "roll your own" cryptographic primitive. This research serves as a stark reminder of the dangers inherent in custom crypto. Manufacturers and developers should subject any proprietary or custom cryptographic algorithms to rigorous external security audits and adhere to established cryptographic best practices.
- Stay Updated and Use Secure Hardware: While the nRF52840 was used as a development platform for the attack, it also represents newer hardware that can support advanced BLE 5 features like Coded PHY and 2 Mbps. Future research might focus on exploiting these specific PHYs. Defenders should ensure their devices use the latest, most secure hardware and firmware, and that these are configured correctly to leverage available security features. Cauquil also mentioned the potential to port BtleJack to the nRF52840 for full BLE 5 feature support, indicating ongoing research in this area.
- Monitor for Anomalous RF Activity: While challenging, monitoring the 2.4 GHz band for unusual packet injection or disconnections could be an indicator of jamming or hijacking attempts. However, given the nature of BLE and the attack, this might be difficult to distinguish from legitimate interference without highly specialized equipment and analysis.
In essence, Cauquil's work is a call to action for the BLE ecosystem. The protocol provides security features, but they are often neglected. Until these features are universally adopted and correctly implemented, BLE 5 devices, despite their advanced coexistence mechanisms, remain highly susceptible to sophisticated yet practical attacks.
Key Takeaways
- BLE 5's new Channel Selection Algorithm (CSA #2) is designed for coexistence, not security. The Pseudo-Random Number Generator (PRNG) it employs is predictable and was not intended to provide cryptographic protection.
- The BLE 5 PRNG is vulnerable because its seed (Channel Identifier) is publicly derivable from the Access Address, and its internal state (counter) can be recovered. This allows an attacker to predict the exact channel hopping sequence of a BLE 5 connection.
- Practical attacks including sniffing, jamming, and potentially hijacking are feasible against BLE 5 connections using this vulnerability. Damien Cauquil demonstrated successful synchronization, sniffing, and jamming using his modified BtleJack tool on nRF52840 development boards.
- The "don't roll your own crypto" principle was violated. The custom-designed PRNG, while easy to implement on low-power devices, introduced a fundamental security flaw that allows for state recovery and prediction.
- Developers must actively use built-in BLE security features. A significant majority (estimated 90%) of BLE devices still operate with unprotected connections, making them vulnerable regardless of the channel selection algorithm. Secure connections, encryption, and authentication are paramount.
- The research highlights the ongoing need for rigorous security analysis of all protocol mechanisms, even those not explicitly designed for security. Operational improvements can inadvertently create new attack surfaces.
About the Speaker(s)
Damien Cauquil is the Head of Research and Development at Digital Security, a French IT security company specializing in IoT security. He is a prominent IoT security researcher and the main developer behind BtleJack, a widely recognized Bluetooth Low Energy (BLE) Swiss Army knife tool. Cauquil is known for his in-depth understanding of BLE protocols and his ability to identify and exploit vulnerabilities in their implementations. His work, including previous presentations at conferences like Def Con, consistently pushes the boundaries of BLE security research, providing valuable insights for both attackers and defenders in the IoT space.