15  Bluetooth Security

15.1 Learning Objectives

After completing this chapter series, you should be able to:

  • Compare BLE pairing methods (Just Works, Numeric Comparison, Passkey, Out-of-Band) and evaluate their MITM protection levels
  • Explain BLE link-layer encryption mechanisms and justify why application-layer authorization is needed for security-critical devices
  • Analyze common BLE security vulnerabilities including eavesdropping, relay attacks, and downgrade attacks
  • Design a layered security approach combining pairing, encryption, and application-level controls for IoT deployments

Bluetooth security protects your devices from eavesdropping and unauthorized connections. It includes pairing (proving two devices trust each other), encryption (scrambling data so only the intended recipient can read it), and authentication (verifying device identity). Without security, anyone nearby could listen to your wireless earbuds or control your smart lock.

“Bluetooth security is like having a secret handshake with your best friend!” Sammy the Sensor explained. “When I first meet a new phone, we go through pairing – we agree on a secret code that only we know. After that, every message I send is scrambled so that even if someone is listening nearby, they cannot understand a word!”

“Think of it like passing notes in class,” Lila the LED added. “Without encryption, anyone who intercepts the note can read it. But with Bluetooth encryption, the note looks like total gibberish unless you have the secret decoder key. The stronger the pairing method, the harder it is for a snooper to figure out the key!”

Max the Microcontroller looked serious. “The tricky part is choosing the right pairing method. ‘Just Works’ is the easiest – no PINs or codes needed – but it offers zero protection against someone pretending to be your device. For a smart lock or medical device, you need stronger methods like Numeric Comparison, where both devices show a number and you confirm they match.”

“Security does cost a little extra energy,” Bella the Battery admitted, “because encryption takes some processing power. But it is absolutely worth it. Imagine if someone could hack your smart door lock just because it had weak Bluetooth security! Always choose the strongest pairing method your device can support.”

In 60 Seconds

BLE security depends on the pairing method, not just encryption. “Just Works” provides no man-in-the-middle protection, while Numeric Comparison and Out-of-Band pairing offer strong defense. For security-critical IoT devices, always add application-layer authorization on top of link-layer encryption.

Key Concepts
  • BLE Security Mode 1 Levels: Level 1 = no encryption; Level 2 = unauthenticated encryption; Level 3 = authenticated encryption (MITM-protected); Level 4 = authenticated LE Secure Connections
  • LE Secure Connections (LESC): BLE 4.2+ pairing using Elliptic Curve Diffie-Hellman (P-256); generates keys that cannot be derived from passively captured pairing traffic
  • Just Works Pairing: Pairing method with 0-digit confirmation; no MITM protection; appropriate only for non-sensitive devices in physically secured environments
  • Passkey Entry: Pairing using a 6-digit PIN displayed on one device and entered on the other; provides MITM protection with 1-in-1,000,000 chance of success per attempt
  • OOB (Out-Of-Band) Pairing: Key exchange over a side-channel (NFC tap, QR code scan) before BLE connection; provides strongest MITM protection available in BLE
  • Resolvable Private Address (RPA): BLE privacy mechanism generating a new random address every 15 minutes (default), derived from IRK; prevents passive tracking by non-bonded devices
  • LTK (Long Term Key): 128-bit symmetric key stored after bonding; used to resume encrypted sessions without re-pairing; must be stored in secure non-volatile storage
  • CSRK (Connection Signature Resolving Key): Key used for data signing in BLE unencrypted connections; enables data source authentication without full encryption
Minimum Viable Understanding

BLE security is determined primarily by the pairing method chosen, not just encryption. “Just Works” offers no man-in-the-middle protection, while Numeric Comparison and Out-of-Band pairing provide strong defense. For security-critical IoT devices, always add application-layer authorization on top of link-layer encryption.

15.2 Overview

Bluetooth security is critical for IoT deployments, protecting everything from smart locks and medical devices to payment terminals and industrial sensors. This comprehensive guide covers pairing methods, encryption architecture, key management, and defense-in-depth strategies for secure BLE implementations.

Key Takeaway

In one sentence: BLE security depends on the pairing method, not just encryption - “Just Works” provides no MITM protection, while Numeric Comparison and Out-of-Band pairing defend against active attackers during setup.

Remember this: Always match pairing method to threat model: use OOB or Numeric Comparison for security-critical devices (locks, medical, payments), and add application-layer authorization for sensitive commands even after secure pairing.

15.3 Chapter Guide

This topic is covered across three focused chapters:

15.3.1 Bluetooth Security: Pairing Methods

Difficulty: Intermediate | Reading Time: ~15 minutes

Learn the fundamentals of BLE pairing and authentication:

  • Four pairing methods: Just Works, Passkey Entry, Numeric Comparison, and Out-of-Band
  • Why “Just Works” provides no MITM protection and when to avoid it
  • Three-phase BLE pairing process (feature exchange, STK generation, key distribution)
  • Bonding vs pairing trade-offs for IoT deployments
  • Common beginner mistakes and how to avoid them

15.3.2 Bluetooth Security: Encryption and Key Management

Difficulty: Advanced | Reading Time: ~20 minutes

Deep dive into BLE encryption architecture and security decisions:

  • BLE encryption architecture (Legacy, LE Secure Connections, BR/EDR)
  • Key hierarchy: LTK, IRK, CSRK and their roles
  • Security decision framework for choosing the right protection level
  • Best practices for secure pairing and key storage
  • Common pitfalls: displayless device security, bonded key protection

15.3.3 Bluetooth Security: Labs and Defense-in-Depth

Difficulty: Advanced | Reading Time: ~25 minutes

Hands-on labs and comprehensive security strategies:

  • Interactive ESP32 BLE security demonstration lab
  • Challenges: security mode comparison, packet interception, brute-force protection
  • Defense-in-depth: four layers from physical to data protection
  • BLE attack timeline across device lifecycle
  • Visual reference gallery and knowledge check assessments

15.4 Prerequisites

Before diving into these chapters, you should be familiar with:

Deep Dives:

Comparisons:

Security Context:

Learning Resources:

  • Quizzes Hub - Test your Bluetooth security knowledge
  • Videos Hub - Visual explanations of BLE security concepts

15.5 Quick Reference

15.5.1 Pairing Method Security Comparison

Method MITM Protection Best Use Case
Just Works None Public beacons only
Passkey Entry Moderate Keyboards, mice
Numeric Comparison Strong Smartphones, tablets
Out of Band (OOB) Very Strong Smart locks, medical, payments

15.5.2 Security Quick Tips

Do:

  • Use Numeric Comparison or OOB for sensitive applications
  • Enable LE Secure Connections (BLE 4.2+)
  • Store keys in hardware-backed keystore
  • Implement application-layer authorization
  • Update firmware regularly

Don’t:

  • Use “Just Works” for anything requiring security
  • Assume encryption means complete security
  • Rely on Bluetooth range for protection
  • Skip authorization for sensitive commands

15.5.3 Knowledge Check: BLE Pairing Methods

15.5.4 Knowledge Check: Defense in Depth

Decision Framework: Selecting BLE Pairing Method Based on Device Constraints

When designing a BLE device, choose the pairing method based on available I/O capabilities and security requirements:

Device Type I/O Capability Security Need Recommended Method Example
Beacon None Low Just Works Proximity marketing, asset tags
Sensor None Medium Passkey Entry (fixed PIN) Environmental monitoring (trusted network)
Wearable Display only High Numeric Comparison Fitness tracker pairing with smartphone
Smart Lock Display + button Critical OOB (NFC tap) Door lock, bike lock
Medical Device Display + keypad Critical OOB or Numeric Comparison Glucose monitor, insulin pump
Industrial None (headless) High OOB (pre-shared key) Factory sensors, SCADA endpoints

Decision Rules:

  1. If device has NO display/input: Use OOB with NFC/QR code for security-critical applications
  2. If device has display only: Use Numeric Comparison (user confirms 6-digit match)
  3. If device has keypad only: Use Passkey Entry (user types 6-digit code)
  4. If public/non-sensitive: Just Works acceptable only for beacons broadcasting public data

Cost vs Security Trade-off:

  • Adding NFC chip: ~$0.50-1.00 per device (enables OOB)
  • Adding display: ~$2-5 per device (enables Numeric Comparison)
  • Security breach cost: $50K-500K+ (GDPR fines, recall, reputation damage)

Quantifying MITM attack probability: Numeric Comparison vs Just Works

Numeric Comparison pairing shows a 6-digit verification code on both devices. What is the probability an attacker can successfully impersonate a device?

Numeric Comparison (6-digit code):

The code ranges from 000000 to 999999: $ = 10^6 = 1{,}000{,}000 $

For a man-in-the-middle attacker to succeed, they must: 1. Intercept the pairing attempt 2. Guess the correct 6-digit number 3. Display it to the user before the legitimate device does

Probability of guessing correctly on first try: $ P_{} = = 0.0001% = 1 1{,}000{,}000 $

Just Works pairing (no verification):

No user verification code is displayed. The attacker only needs to: 1. Intercept the pairing request 2. Complete key exchange with both devices separately

Since there’s no out-of-band verification: $ P_{} = 100% $

Security improvement ratio: $ = = 1{,}000{,}000 $

Real-world attack scenario:

A hospital deploys 500 BLE patient monitors. With Just Works pairing, an attacker with a malicious device could intercept ALL pairing attempts. With Numeric Comparison: $ = 500 = 0.0005 $

Effectively zero. This million-fold security improvement costs only ~$2 per device (adding a small LCD display), making Numeric Comparison the clear choice for any security-sensitive application.

15.5.5 Knowledge Check: LE Secure Connections

15.6 Summary

This chapter provided an overview of Bluetooth security for IoT:

  • Pairing methods range from “Just Works” (no MITM protection) to Out-of-Band (very strong protection), and the choice depends on device UI capabilities and threat model
  • LE Secure Connections (BLE 4.2+) uses P-256 ECDH key exchange and AES-128 CCM encryption; legacy pairing (BLE 4.0/4.1) uses a 6-digit Temporary Key (TK, range 0–999999) that is vulnerable to brute-force when Just Works is used
  • Key hierarchy (LTK, IRK, CSRK) separates encryption, privacy, and signing concerns; the IRK enables resolution of random resolvable private addresses (which rotate approximately every 15 minutes for privacy)
  • Defense in depth requires application-layer authorization, session management, and firmware update security beyond link-layer encryption
  • Security selection must match the application: public beacons can use Just Works, while medical devices and smart locks demand authenticated pairing with OOB or Numeric Comparison

15.7 What’s Next

Chapter Focus Why Read It
Bluetooth Security: Pairing Methods Just Works, Passkey, Numeric Comparison, OOB Start here if new to BLE security — covers all four pairing methods and when to use each
Bluetooth Security: Encryption and Key Management LTK, IRK, CSRK, LE Secure Connections vs Legacy Essential for developers implementing secure BLE firmware or choosing security modes
Bluetooth Security: Labs and Defense-in-Depth ESP32 lab, four-layer defense strategy Hands-on practice and comprehensive strategies for production IoT deployments
Bluetooth Comprehensive Review Integrated case studies, assessment questions Validate understanding across all Bluetooth security topics before deployment
Wi-Fi Security and Provisioning WPA3, 802.1X, provisioning flows Compare BLE pairing security to Wi-Fi provisioning approaches
Encryption Architecture and Levels AES, ECDH, key derivation functions Deepen understanding of the cryptographic primitives underlying BLE security