Merge remote-tracking branch 'agent/benma-agent/stage1-pairing-lifecycle'
What changed, and why it matters
This update fixes a Bluetooth pairing bug in the BitBox02 Nova hardware wallet. When the device switched from Bluetooth back to USB mode, it could keep an old pairing request active. The fix clears that stale pairing state so the device does not act on an outdated or unintended pairing code.
Treat as a low-to-moderate security fix. Users with a BitBox02 Nova should update to a firmware/bootloader release containing this commit. Reviewers may want to confirm no other pairing state (e.g., bonding database entries) remains stale after the mode switch.
Security signals we found
Clearing of stale Bluetooth pairing state on mode switch
Pairing code/request flag left set across BLE->USB transition before fix
Bluetooth pairing lifecycle change in bootloader startup path
Evidence from the diff
The commit moves declarations of bootloader_pairing_request and bootloader_pairing_code_bytes[4] into the bootloader header and changes the type from int to bool. More importantly, it adds bootloader_pairing_request = false after rust_communication_mode_ble_disable() in startup.c, clearing the BLE pairing flag when the device leaves Bluetooth mode. The changelog describes this as fixing a stale Bluetooth pairing state when switching to USB. The change is small and defensive, but the exact exploit path is not detailed in the commit itself.
Changed components
BitBox02 Nova bootloadersrc/bootloader/startup.csrc/bootloader/bootloader.csrc/bootloader/bootloader.hsrc/da14531/da14531_handler.cInspect captured patch +7 / −6
### CHANGELOG.md
@@ -231,6 +231,7 @@ recorded separately.
## Bootloader
### Unreleased
+- BitBox02 Nova: fix stale Bluetooth pairing state when switching to USB.
### v1.2.3
- Verify firmware with a versioned signature prehash.
### src/bootloader/bootloader.c
@@ -268,9 +268,6 @@ void bootloader_render_default_screen(void)
}
#if PLATFORM_BITBOX02PLUS
-extern bool bootloader_pairing_request;
-extern uint8_t bootloader_pairing_code_bytes[4];
-
void bootloader_render_ble_confirm_screen(bool confirmed)
{
qtouch_force_calibrate();
### src/bootloader/bootloader.h
@@ -5,6 +5,7 @@
#include <platform_config.h>
#include <stdbool.h>
+#include <stdint.h>
void bootloader_jump(void);
@@ -14,6 +15,9 @@ void bootloader_jump(void);
void bootloader_render_default_screen(void);
#if PLATFORM_BITBOX02PLUS
+extern bool bootloader_pairing_request;
+extern uint8_t bootloader_pairing_code_bytes[4];
+
/**
* Renders a BLE pairing confirmations screen. Use the `confirmed` argument to display the
* "user has confirmed on bitbox" version.
### src/bootloader/startup.c
@@ -48,7 +48,7 @@ uint32_t __stack_chk_guard = 0;
#if PLATFORM_BITBOX02PLUS == 1
extern volatile bool measurement_done_touch;
-int bootloader_pairing_request = false;
+bool bootloader_pairing_request = false;
uint8_t bootloader_pairing_code_bytes[4] = {0};
// Must fit bond_db.
#define UART_OUT_BUF_LEN 2048
@@ -144,6 +144,7 @@ int main(void)
uart_poll(NULL, 0, NULL, uart_write_queue);
}
rust_communication_mode_ble_disable();
+ bootloader_pairing_request = false;
bootloader_render_default_screen();
}
#endif
### src/da14531/da14531_handler.c
@@ -80,8 +80,6 @@ static void _ble_pairing_callback(bool ok, void* param)
}
#else
#include <bootloader/bootloader.h>
-extern bool bootloader_pairing_request;
-extern uint8_t bootloader_pairing_code_bytes[4];
#endif
#if FACTORYSETUP == 1Why this scored 35/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.