Blog / A02:2021 Cryptographic Failures
A02:2021 · Cryptographic Failures

27 bytes of a 32-byte key, in every scan response

The advertisement carried the first five bytes of the key. The scan response returned the other 27 in the clear. A radio and a few seconds gets you the whole thing.

a nearby devicesends a…the handlerbuilds a…raw key bytes arecopied…the response goesout over the aira listenerreassembles…ATTACKER INPUTIMPACTwritten to logs
Attack path · a nearby device sends a scan request → the handler builds a scan response → raw key bytes are copied in unmasked → the response goes out over the air → a listener reassembles the full key

The advertisement carried the first five bytes of the key. The scan response returned the other 27 in the clear. A radio and a few seconds gets you the whole thing.

What goes wrong

BLE advertisements and scan responses are public. Anything you put in them is readable by any radio in range, with no pairing required and nobody's permission asked. So when a scan response returns bytes 5 through 31 of a key as-is, those bytes are on the air for anyone who cares to listen.

Splitting the key across two payloads feels like it hides something, but both payloads are observable in the same pass. Combine the five bytes riding in the advertisement with the 27 here and you have reconstructed a 32-byte key without touching the device. Obscurity across two public channels is still two public channels.

The pattern

Vulnerable
byte[] buildScanResponse(byte[] key) {
  // return the tail of the key so the advert stays small
  byte[] out = new byte[27];
  copy(key, 5, out, 0, 27);   // raw key bytes, no masking
  return out;
}
Hardened
byte[] buildScanResponse(DeviceId id) {
  // advertise a public handle, never key material
  return publicHandle(id);
}
// the shared key is agreed after an authenticated pairing,
// off the air, and never appears in a broadcast payload
How the pipeline adjudicated itHELD
ABCDEFGH

Grounding and reachability were confirmed. The exploit-path gate would not conclude without the calling code, so the finding was held and an evidence request was raised instead of being reported as fact.

Ed25519 · per-tenant signing key · gate ledger A–H · verify offline against the published payload hash

Why it matters to you

If your device broadcasts anything derived straight from a long-term secret, treat that secret as published. An attacker records the payloads once and can decrypt your traffic or clone the device for as long as the key lives.

For a shipped BLE product this is a field-level compromise, not a lab curiosity. Every unit that ever transmitted is exposed to anyone who was in range with a cheap sniffer.

Check your own code