I've been using secure DFU over a bonded BLE connection with the following configuration:
- S140 6.0.0
- nRF5 SDK 15.0.0
- nRF Connect for Android
#define NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS 1 // In application sdk_config.h
#define NRF_DFU_BLE_REQUIRES_BONDS 1 // In bootloader sdk_config.h
This has been working well. Once the application has stored bonding information for a peer, entry to DFU bootloader can occur and I've been able to update the app individually or bootloader+SoftDevice+app.
However, I'm concerned that if the peer performing the upgrade loses its bonding information during specific circumstances during an upgrade process, that the device will no longer be able to run an application. Bonding information on a smartphone could be lost by user error such as a user closing nRF Connect during and upgrae and requesting to 'Forget this device' in Bluetooth settings.
The specific failures that I hypothesise would result in a bricked unit are:
- During an app upgrade where dual bank update is not possible (eg. application is too big to support dual bank update). If the upgrade process was interrupted near the end of the app download, then bonding keys were deleted from the peer, the bootloader would eventually time out and reset. As there is no longer valid runnable application due to having been overwritten by the upgrade process, the bootloader enters DFU mode without running any application. No further DFU updates via BLE would be possible due to there being missing bonding keys from one side of the link.
- During a bootloader+SoftDevice+application upgrade. These upgrades occur in two steps, bootloader+SoftDevice first, then application. In this type of upgrade, it is likely that the original application is incompatible with the updated SoftDevice due to SoftDevice API changes, forcing an upgrade to a new application rather than being able to retain the existing app. Similar to the case above, if bonding keys are deleted from the peer after the bootloader+SoftDevice part of the upgrade, there is no longer a valid runnable app (existing app is incompatible with new SoftDevice) and no further DFU upgrades are possible due to missing BLE keys on the peer.
Now for my questions.
Are the situations I have proposed plausible, and so effectively result in an unusable device which will be stuck in bootloader mode where no further upgrades can be performed due to missing pairing information on the bonded peer?
If yes, what are some possible mitigation for these scenarios?
Would any of the following ideas for fixing this work?
- An
sdk_config.h
option which would allow repairing within the bootloader on pairing failures. This is likely application specific and would require the ability to set re-pairing options such as IO capabilities. - An
sdk_config.h
option which would allow unsecured communications if remote bonds are detected as missing for a connection. As the downloaded packages are typically signed, an attacker could use this insecure feature to download an unwanted application but the upgrade would fail if the downloaded application was not signed with correct keys.