TExcelTAD
Home › Wireless, IoT & Mobile Security › Bluetooth Classic and Bluetooth Low Energy

Bluetooth Classic and Bluetooth Low Energy

"Bluetooth" names two different radio systems that share a brand and a band. Bluetooth Classic (BR/EDR, basic rate / enhanced data rate) carries continuous streams: headphones, car kits, file transfer. Bluetooth Low Energy (LE, since Bluetooth 4.0 in 2010) sends short bursts from devices that run for months on a coin cell: fitness bands, smart locks, sensors, and the smart plug of this course. Their security mechanisms differ in important ways, and most IoT devices speak only LE. This lesson sets out the architecture and reads what an LE device broadcasts to everyone around it.

Two radios, one name

Bluetooth Classic (BR/EDR) Bluetooth Low Energy
typical use audio, hands-free, legacy serial links sensors, wearables, locks, beacons, setup of IoT devices
channels in 2.4 GHz 79 channels of 1 MHz, frequency hopping 40 channels of 2 MHz: 3 for advertising (37, 38, 39), 37 for data
discovery inquiry and inquiry scan advertising packets, sent every 20 ms to 10 s, readable by anyone
data model profiles over L2CAP/RFCOMM (A2DP, HFP, …), service discovery with SDP GATT: services and characteristics on top of ATT
pairing Secure Simple Pairing (2.1, 2007); Secure Connections (4.1) LE Legacy Pairing (4.0); LE Secure Connections (4.2, 2014)
encryption E0 (legacy), AES-CCM with Secure Connections AES-CCM

Dual-mode chips (phones, laptops) speak both; a key derived on one transport can be converted for the other (cross-transport key derivation), which was the setting of the 2020 BLURtooth finding, fixed by restricting when keys may be overwritten.

LE roles and the GATT model

  • GAP roles: an advertiser (peripheral, such as the plug) announces itself; a scanner (central, such as the phone) listens and connects.
  • After connecting, the central reads and writes characteristics grouped in services on the peripheral's GATT server, each identified by a UUID and protected by permissions (readable, writable, needs encryption, needs an authenticated pairing). A smart plug has a "relay state" characteristic; a lock has an "unlock" one. GATT security is about who may write those.

LE device addresses

An LE address is 48 bits, but it is not always a fixed hardware address. The two most significant bits of a random address say which kind it is:

Address type Top bits Changes Use
public (IEEE-assigned OUI) never vendor-assigned, like an Ethernet MAC
random static 11 at power cycle, if at all many IoT devices
resolvable private (RPA) 01 every few minutes phones and wearables: only bonded peers can recognise it (BLE privacy)
non-resolvable private 00 often beacons that don't need to be recognised

What an advertisement reveals

Advertising packets are sent in the clear to anyone in range, usually tens of metres and much further with a good antenna. An ADV_IND packet has a 2-byte header (PDU type, address-type flags, length), the advertiser's address (6 bytes, least significant byte first) and up to 31 bytes of AD structures, each length, type, data. The program builds the plug's advertisement the way its firmware does and parses it the way any phone app or sniffer would:

python · try it yourself
import struct

def ad(t, data): return bytes([len(data) + 1, t]) + data
# Advertising data of the lab smart plug, as its firmware builds it (synthetic)
adv_data = (ad(0x01, b"\x06")                                    # flags: LE General Discoverable, no BR/EDR
            + ad(0x09, b"LabPlug-07")                            # complete local name
            + ad(0x03, struct.pack("<H", 0xFFF0))                # 16-bit service UUID (a lab value)
            + ad(0xFF, struct.pack("<H", 0xFFFF) + b"\x01\x04\x02" + b"SN-0007-4821"))  # manufacturer data: 0xFFFF = test ID
adv_addr = bytes.fromhex("c20000b1e007")[::-1]                  # "static" device address (top bits 11), little-endian on air
header = struct.pack("<BB", 0x40 | 0x00, len(adv_addr) + len(adv_data))   # ADV_IND (type 0), TxAdd=1 (not a public address)
pdu = header + adv_addr + adv_data
print("PDU:", pdu.hex(" "))

TYPES = {0x01: "flags", 0x09: "name", 0x03: "16-bit UUIDs", 0xFF: "manufacturer"}
h0, length = pdu[0], pdu[1]
print(f"PDU type {h0 & 0x0F} (ADV_IND), TxAdd {(h0 >> 6) & 1} (1 = not a public address), payload {length} bytes")
print("advertiser address:", ":".join(f"{b:02x}" for b in pdu[2:8][::-1]))
pos, data = 0, pdu[8:]
while pos < len(data):
    ln, t = data[pos], data[pos + 1]
    val = data[pos + 2:pos + 1 + ln]
    if t == 0xFF:
        company, = struct.unpack_from("<H", val)
        shown = f"company 0x{company:04X}, fw {val[2]}.{val[3]}.{val[4]}, serial {val[5:].decode()}"
    elif t == 0x09:
        shown = val.decode()
    else:
        shown = val.hex()
    print(f"  AD {TYPES.get(t, hex(t)):13} {shown}")
    pos += 1 + ln
PDU: 40 2c 07 e0 b1 00 00 c2 02 01 06 0b 09 4c 61 62 50 6c 75 67 2d 30 37 03 03 f0 ff 12 ff ff ff 01 04 02 53 4e 2d 30 30 30 37 2d 34 38 32 31
PDU type 0 (ADV_IND), TxAdd 1 (1 = not a public address), payload 44 bytes
advertiser address: c2:00:00:b1:e0:07
  AD flags         06
  AD name          LabPlug-07
  AD 16-bit UUIDs  f0ff
  AD manufacturer  company 0xFFFF, fw 1.4.2, serial SN-0007-4821

The plug announces its name, a service UUID, its firmware version and its serial number, to everyone, all day. None of that is a vulnerability by itself, but together it lets anyone nearby inventory the devices in a home and find those with a known-vulnerable firmware version, and the serial number may be what the cloud uses to register the device. Company ID 0xFFFF is reserved for tests; a product uses its own Bluetooth SIG company identifier.

The security building blocks

  • Pairing creates keys; bonding stores them for later connections. Pairing methods differ greatly in what they protect against (BLE Pairing Methods).
  • Encryption of the link (AES-CCM) starts after pairing or with a stored key.
  • LE security mode 1 has levels: 1 no security, 2 unauthenticated pairing with encryption, 3 authenticated pairing with encryption, 4 authenticated LE Secure Connections with a 128-bit key. "Secure Connections Only" mode refuses anything below level 4.
  • Privacy with resolvable private addresses; data signing for unencrypted writes (rarely used).
  • Application-layer security on top: many products add their own encryption or authentication in characteristics, with very mixed quality.

How BLE exposure is detected

  • Passive inventory of your own devices with a scanner app or a sniffer in a lab: which names, UUIDs, manufacturer data and address types do they advertise? Repeat after firmware updates.
  • Review the advertising payload in the firmware source or build: serials, firmware versions, user names, "setup mode" flags.
  • Connect to your own device with a generic GATT client (on a test phone) and list services and characteristics with their permissions: anything writable without encryption is a finding.

How it is fixed

  • Advertise the minimum: a generic name, the service UUID needed for discovery, no serials or versions; put details behind an authenticated GATT read.
  • Use resolvable private addresses on devices that move with a person.
  • Require LE Secure Connections and set characteristic permissions to "authenticated encryption" for anything that changes state.
  • Advertise only when needed: during setup, or at a low rate.

Pitfalls

  • Treating short range as a security boundary: directional antennas and sensitive receivers extend it far.
  • Putting an identifier into manufacturer data that is also used as a cloud credential.
  • Assuming the phone app is the only client: any BLE client can talk to the GATT server.

Practice

1. A random LE address starts with 0x5a. What kind of address is it?

0x5a is 01011010 in binary: the top two bits are 01, a resolvable private address. Only devices holding the advertiser's identity resolving key can link it to the device.

2. Change the plug's manufacturer data so that it carries no serial number and no firmware version. What still allows the phone app to find the plug?

The service UUID (and a generic name such as LabPlug). The app scans for that UUID, connects, and reads the serial and version through characteristics that require pairing.

3. Why is radio range a weak protection for a smart lock?

Range is set by the attacker's equipment, not the user's phone: a directional antenna or a relay can extend it greatly. Relay attacks against "unlock when the phone is near" features have been demonstrated for cars and locks, so proximity must not be the only check.

Test yourself

Which channels carry BLE advertising?

  1. All 79 channels
  2. Channels 37, 38 and 39
  3. Only channel 6
  4. None: advertising is encrypted

What did the plug's advertisement reveal that it shouldn't?

  1. Its encryption key
  2. Its serial number and firmware version
  3. The Wi-Fi passphrase
  4. Nothing

Which BLE address type is designed for privacy?

  1. Public
  2. Random static
  3. Resolvable private address
  4. Broadcast

Which LE security mode 1 level means authenticated LE Secure Connections?

  1. Level 1
  2. Level 2
  3. Level 3
  4. Level 4