skip to content

A GATT client holding a bonded LTK gets Insufficient Authentication on an unencrypted link; what should it do next, and what must it avoid?

level: seniorimportance: should knowfreq 22%

answer

  1. try the stored key first
  2. failure means bond lost or wrong device
  3. re-pair only after the user confirms
  4. the MITM flag is the client's own call

basics

~20 s

Start encryption with the stored LTK and retry. Only if that fails, re-pair, and only after a user interaction confirms the remote device. Never request MITM protection merely because of the error; only the client's own requirement may.

solid answer

~50 s

Per GAP 10.3.2, a client that receives Insufficient Authentication on an unencrypted link and holds an LTK should first **start the encryption procedure** with that LTK. If encryption fails, the likely causes are that the remote device lost the bond or that the wrong device is connected, so the client should re-pair, and a client that re-pairs shall first **trigger a user interaction to confirm the remote device**. After a fresh bond it repeats service discovery and re-enables notifications unless the database is unchanged. The client shall not set the MITM-protection-required flag in response to this error on an unencrypted link, because the code does not say MITM is needed; it sets the flag only if the client itself requires it. If authenticated pairing is impossible with the devices' IO capabilities, the request is abandoned.

go deeper

for a junior

Recall that the client may fix the link and retry after a security error, rather than giving up.

for a middle

Describe the order: encrypt with the stored LTK first, re-pair only on failure, and rediscover and reconfigure after a new bond.

for a senior

Explain why a user confirms the remote device before re-pairing, and why the MITM flag follows the client's own requirement, not the error code.

for a principal

Own the product rule for lost bonds on devices without a display, so that re-bonding is never silent and never loops.

## Why the error is ambiguous On an unencrypted link, a server that holds no key for the client answers a protected request with Insufficient Authentication even when the attribute asks only for encryption. GAP states this plainly: the code "does not indicate to the local device that MITM protection is required". The client therefore cannot read its next move from the code alone. It has to look at what it holds and what it requires itself. ## The decision flow in GAP 10.3.2 1. If the client's own security database needs no encryption, the request may go ahead without encryption or pairing. 2. If the client has a bond, it should enable or request encryption **before** sending any service request after a reconnection. If it did not, and it then receives an error while holding an LTK, it starts the encryption procedure: GAP says it *should* for Insufficient Authentication on an unencrypted link and *shall* for Insufficient Encryption. 3. If encryption succeeds and the link now meets the requirement, the request proceeds. 4. If encryption fails, the specification reads this as "likely indicating that the remote device has lost the bond", or that the wrong LTK or the wrong device is involved. The client should re-pair, and if it does it **shall trigger a user interaction to confirm the remote device before starting pairing**. 5. If the link is encrypted but an authenticated pairing is required and only an unauthenticated one occurred, pairing is executed again with the required authentication settings. If it fails, or the IO capabilities of the two devices cannot deliver authenticated pairing, the request is aborted. 6. If LE Secure Connections authenticated pairing is required and the remote device does not support Secure Connections, the request is aborted. 7. A Peripheral acting on the server side may itself send a Peripheral Initiated Security Request, asking the Central to start the security procedure, so the same flow can be triggered from either end. ```pseudocode on error Insufficient Authentication / Insufficient Encryption: if link encrypted and pairing was unauthenticated and authenticated is required: pair again with the authentication this client requires abort if IO capabilities cannot deliver it else if an LTK is stored: start encryption with the stored LTK if encryption fails: ask the user to confirm the remote device re-bond, then rediscover services and re-enable notifications else: pair using this client's own authentication settings; abort on failure mitm_required = this client itself requires MITM protection # never set from the error ``` ## Why the user is involved Failing encryption with a stored key has two innocent explanations (the other side was reset or its bond was deleted) and one that matters to a security reviewer (a different device answered). If the client re-paired silently, it would accept whichever device responded and bind a new trusted relationship to it. The required user interaction is the control that ties the new bond to the device the owner means. Without a user interface, the product needs another explicit confirmation step. ## What must be redone after a new bond - **Service discovery,** unless the client had learned the server has no Service Changed characteristic, or it reads the Database Hash and finds it unchanged. - **Reconfiguration of the server,** such as re-enabling notifications and indications on the relevant characteristics, because that configuration was held against the old bond. - **Address handling:** if the encryption procedure fails and either side used a resolvable private address to connect, GAP 10.6 says the current RPAs are discarded at once and new ones generated. ## Where this logic belongs Keep the flow in one place in the client rather than in each feature's error handling. Then every feature inherits the same rule for lost bonds, the same user confirmation and the same MITM-flag behaviour, and a reviewer has one piece of code to read instead of one per characteristic. ## What a reviewer can look for | Observation | What it may indicate | |---|---| | Re-pairing prompts that appear after every reconnect | the client does not enable encryption with its bond before service requests | | A bond silently replaced with no prompt | the confirmation step is missing | | A client that always asks for MITM protection on error 0x05 | the flag is driven by the error rather than the client's requirement | | Requests abandoned after repeated pairing failures | requirement exceeds the devices' IO capabilities | Treat each as a finding about the client's behaviour, not about the server.

  • Why does GAP want a user to confirm the remote device before the client re-pairs after an encryption failure?
    A failed encryption with a stored LTK means either the peer lost its bond or a different device is connected. Re-pairing without a check would trust whichever device answers. The user interaction binds the new bond to the device the owner intends, and a product without a display needs an equivalent explicit step.
  • What should a client do right after reconnecting to a bonded server it expects notifications from?
    Enable or request encryption before any service request, and check the server's security requirements against the persisted subscription. Notifications received before the requirement is met are ignored, and indications are confirmed and discarded. If the server has lost its LTK, enabling encryption fails and the client treats that as a lost bond.
  • After a successful re-bond, what must the client redo?
    Discover services again and reconfigure the server, for example re-enable notifications and indications on the relevant characteristics. Discovery may be skipped only if the server has no Service Changed characteristic or the client reads the Database Hash and finds it unchanged.

  • On Insufficient Authentication always start a fresh pairing with MITM protection required
  • If encryption with the stored key fails, silently delete the bond and pair again
  • The client should keep retrying the same request until the server accepts it
  • After re-pairing, the old notification subscriptions on the server still apply
  • Insufficient Authentication on an unencrypted link proves the attribute requires MITM protection