Skip to content

Harden BLE pairing and actually revoke removed phones #9

Open
2 of 3 issues completed
Open

Description

@Tichael
  • Revocation doesn't work. On ESP, RemovePairedPhone / ClearPairedPhones
    (boards/esp/src/lib.rs:80) only edit the in-memory PAIRED_PHONES list,
    which nothing on ESP uses for authorization. The real credentials (LTKs in
    BondStore flash plus the controller filter-accept/resolving lists) are
    untouched, so a removed phone still connects. Remove the bond via
    stack.remove_bond_information, BondStore::remove_bond and
    remove_bond_from_controller (all exist in ble/transport.rs), and drop the
    separate registry or make it the source of truth.
  • Just Works pairing and the boot-time window on buttonless boards: BLE pairing on boards without a button accepts any phone for 60 s after every boot #18.
  • Auto-heal is too aggressive. ble/transport.rs:521 treats
    REMOTE_USER_TERMINATED_CONN (a normal phone disconnect) as a security
    failure, so any disconnect during the pairing window wipes that phone's bond.
  • max_bonded_phones isn't enforced on BLE bonds (the store is hard-capped at 8).
  • Later: LTKs are stored unencrypted in flash (flash encryption).

Sub-issues

Sub-issues

2 of 3 Issues completed
Loading 3 sub-issues

Activity

  1. added theissue type on Oct 21, 2026
  2. Tichael commented on Oct 22, 2026

    @Tichael
    CollaboratorAuthor

    Status after #45 (closes #17), tested on a WiCAN with one Android phone (Pixel). The PR description has the full list.

    Verified on hardware: removing or clearing while connected revokes the bond and disconnects the phone, and that survives a reboot. A normal hang-up after an encrypted session keeps the bond. Remove / Clear are refused with the window closed. Stale-bond recovery (the board still has the bond, the phone forgot it) needed one more change: Android reports it as a normal hang-up before the link encrypts, so a hang-up now counts as a broken bond only if the link never got encrypted.

    Not verified yet:

    • With a second device: removing a phone that isn't connected (the path between connections in the advertise loop), removing one bond while another stays, and refusing a new phone once max_bonded_phones is reached.
    • iOS / unresolved random addresses. Recognising a known phone at connect also accepts match_address, but two other checks compare the bond's identity address with peer_identity().bd_addr directly: whether a removed phone is the connected one (hits_peer in gatt_event_task), and the auto-heal lookup. If a phone ever shows up with an address the controller didn't resolve, Remove would revoke the bond without disconnecting it, and auto-heal wouldn't find the bond. The Pixel always reconnected with its identity address, so this wasn't exercised.

    Also open: on ESP, ListPairedPhones only writes a debug log line and never replies, so the app can't show the paired phones yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions