What changed, and why it matters
This commit expands the BitBox02 hardware wallet's Bitcoin message-signing feature to also accept key paths starting with the unhardened purpose 'm/49'. Previously only hardened m/45' and m/48' were treated as valid 'external service' keypaths. The change is presented as a feature for Casa (casa.io) to verify control of keys. It is not a vulnerability fix; it is a deliberate relaxation of an access check, accompanied by tests and a version bump.
Review whether unhardened m/49 message signing aligns with the intended security model for external-service keys. Confirm that the UI warning clearly informs users they are signing on behalf of an external service, and that no other checks (e.g., script type compatibility) were inadvertently weakened. No immediate patch is indicated by the diff itself.
Security signals we found
Relaxation of keypath allowlist for message signing
Unhardened purpose m/49 added to external-service signing namespace
User confirmation prompt still required ('External service key')
Same depth limit (10 components) retained
Hardened m/49' explicitly rejected in tests
Evidence from the diff
The patch modifies signmsg.rs to add 49 (unhardened) to EXTERNAL_SERVICE_PURPOSES alongside 45’ and 48’. The existing validation function already enforces a maximum depth of 10 path components and requires the first component to be one of the allowed purposes. The test suite is updated to cover m/49 and to verify that m/49’ (hardened) is still rejected. The Python test helper and CHANGELOG are updated accordingly, and firmware version is bumped to v9.30.0.
Changed components
BitBox02 firmware Bitcoin message signing APIsrc/rust/bitbox02-rust/src/hww/api/bitcoin/signmsg.rspy/send_message.py test helperCHANGELOG.mdversions.jsonInspect captured patch +63 / −19
### CHANGELOG.md
@@ -8,6 +8,7 @@ recorded separately.
### Unreleased
- Reject master xpub exports at `m/` through the Bitcoin API
+- Allow Bitcoin message signing with external service keypaths starting with unhardened `m/49`
### v9.29.0
- Require wallet-owned refund addresses for SwapKit
### py/send_message.py
@@ -1150,7 +1150,7 @@ def sign_testnet() -> None:
sign(bitbox02.btc.TBTC, keypath, script_config)
def sign_external_service(purpose: int) -> None:
- keypath = [purpose + HARDENED, 0 + HARDENED, 0 + HARDENED, 0, 0]
+ keypath = [purpose, 0 + HARDENED, 0 + HARDENED, 0, 0]
script_config = bitbox02.btc.BTCScriptConfig(
simple_type=bitbox02.btc.BTCScriptConfig.P2WPKH
)
@@ -1161,8 +1161,9 @@ def sign_external_service(purpose: int) -> None:
choices = (
("Mainnet", sign_mainnet),
("Testnet", sign_testnet),
- ("External service (m/45')", lambda: sign_external_service(45)),
- ("External service (m/48')", lambda: sign_external_service(48)),
+ ("External service (m/45')", lambda: sign_external_service(45 + HARDENED)),
+ ("External service (m/48')", lambda: sign_external_service(48 + HARDENED)),
+ ("External service (m/49)", lambda: sign_external_service(49)),
)
choice = ask_user(choices)
if callable(choice):
### src/rust/bitbox02-rust/src/hww/api/bitcoin/signmsg.rs
@@ -25,8 +25,12 @@ const MAX_MESSAGE_SIZE: usize = 1024;
const MAX_KEYPATH_DEPTH: usize = 10;
const EXTERNAL_SERVICE_PURPOSE_M45: u32 = 45 + HARDENED;
const EXTERNAL_SERVICE_PURPOSE_M48: u32 = 48 + HARDENED;
-const EXTERNAL_SERVICE_PURPOSES: [u32; 2] =
- [EXTERNAL_SERVICE_PURPOSE_M45, EXTERNAL_SERVICE_PURPOSE_M48];
+const EXTERNAL_SERVICE_PURPOSE_M49: u32 = 49;
+const EXTERNAL_SERVICE_PURPOSES: [u32; 3] = [
+ EXTERNAL_SERVICE_PURPOSE_M45,
+ EXTERNAL_SERVICE_PURPOSE_M48,
+ EXTERNAL_SERVICE_PURPOSE_M49,
+];
/// Validate a keypath in the external service application namespace.
fn validate_external_service_keypath(keypath: &[u32]) -> Result<(), Error> {
@@ -192,11 +196,9 @@ mod tests {
#[test]
fn test_validate_external_service_keypath() {
- assert!(validate_external_service_keypath(&[EXTERNAL_SERVICE_PURPOSE_M45]).is_ok());
- assert!(validate_external_service_keypath(&[EXTERNAL_SERVICE_PURPOSE_M48]).is_ok());
- assert!(
- validate_external_service_keypath(&[
- EXTERNAL_SERVICE_PURPOSE_M45,
+ for purpose in [45 + HARDENED, 48 + HARDENED, 49] {
+ let keypath = [
+ purpose,
0 + HARDENED,
0,
1 + HARDENED,
@@ -206,9 +208,16 @@ mod tests {
3 + HARDENED,
3,
4,
- ])
- .is_ok()
- );
+ 5,
+ ];
+ for depth in 1..=MAX_KEYPATH_DEPTH {
+ assert!(validate_external_service_keypath(&keypath[..depth]).is_ok());
+ }
+ assert_eq!(
+ validate_external_service_keypath(&keypath),
+ Err(Error::InvalidInput)
+ );
+ }
assert_eq!(
validate_external_service_keypath(&[]),
@@ -223,17 +232,15 @@ mod tests {
Err(Error::InvalidInput)
);
assert_eq!(
- validate_external_service_keypath(&[44 + HARDENED]),
+ validate_external_service_keypath(&[49 + HARDENED]),
Err(Error::InvalidInput)
);
assert_eq!(
- validate_external_service_keypath(&[46 + HARDENED]),
+ validate_external_service_keypath(&[44 + HARDENED]),
Err(Error::InvalidInput)
);
assert_eq!(
- validate_external_service_keypath(
- &[EXTERNAL_SERVICE_PURPOSE_M48; MAX_KEYPATH_DEPTH + 1]
- ),
+ validate_external_service_keypath(&[46 + HARDENED]),
Err(Error::InvalidInput)
);
}
@@ -388,6 +395,41 @@ mod tests {
);
}
+ #[async_test::test]
+ pub async fn test_process_m49() {
+ let request = pb::BtcSignMessageRequest {
+ coin: BtcCoin::Btc as _,
+ script_config: Some(pb::BtcScriptConfigWithKeypath {
+ script_config: Some(pb::BtcScriptConfig {
+ config: Some(Config::SimpleType(SimpleType::P2wpkh as _)),
+ }),
+ keypath: vec![49],
+ }),
+ msg: MESSAGE.as_bytes().to_vec(),
+ host_nonce_commitment: None,
+ };
+
+ mock_unlocked();
+ let mut mock_hal = TestingHal::new();
+ assert_eq!(
+ process(&mut mock_hal, &request).await,
+ Ok(Response::SignMessage(pb::BtcSignMessageResponse {
+ signature: hex!(
+ "470dacd1ec8426cc857ca7fb2b8871e7f1039e5c84a845e680b6b84182271d1834599efeb6406ba234be5d1909059770d1a374988b8ae36293419ab3d9d3a2c101"
+ )
+ .to_vec(),
+ }))
+ );
+ assert_eq!(
+ mock_hal.ui.screens[0],
+ Screen::Confirm {
+ title: "Sign message".into(),
+ body: "Coin: Bitcoin\nExternal service key".into(),
+ longtouch: false,
+ }
+ );
+ }
+
#[async_test::test]
pub async fn test_p2wpkh_long_message_warning() {
let msg = "m".repeat(MAX_CONFIRM_BODY_SIZE + 1);
### versions.json
@@ -1,5 +1,5 @@
{
- "firmware": "v9.29.0",
+ "firmware": "v9.30.0",
"bootloader": "v1.2.3",
"stage0": 3
}Why this scored 30/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.