SFT-7112: moved message signing subpath cleaning up in the process to
What changed, and why it matters
This firmware update tightens how the Passport hardware wallet parses a message-signing command. Previously, the code figured out what kind of Bitcoin address to use from the user's key path before it had fully validated and cleaned up that path. The change moves validation and cleanup earlier, so the device no longer derives address types from a potentially malformed or unexpected path. In plain terms: it closes a window where a weird or tampered key path could confuse the wallet about which address type it is signing for.
Treat as a low-to-moderate hardening fix. Review whether get_addr_type_from_deriv() could previously be influenced by malformed paths to select an unintended address type, and confirm validate_sign_text() covers all accepted path formats. No immediate emergency response is indicated, but the fix should be included in the next firmware release.
Security signals we found
Reordering of validation before address-type derivation
Commit message states intent to prevent deriving address types from malformed paths
Use of validate_sign_text() return value to overwrite self.subpath
Single code file change in message/health-check signing flow
Evidence from the diff
In health_check_common_flow.py the validate_lines() method is reordered. For single-line ‘signmessage
Changed components
ports/stm32/boards/Passport/modules/flows/health_check_common_flow.pyMessage signing flowHealth check signing flowInspect captured patch +21 / −7
### ports/stm32/boards/Passport/modules/flows/health_check_common_flow.py
@@ -20,11 +20,15 @@ def __init__(self, lines, normal_signing=False):
async def validate_lines(self):
from pages import ErrorPage
from utils import validate_sign_text
+
err_label = 'Message' if self.normal_signing else 'Health check'
+ # single-line `signmessage <path> ascii:<message>` (Envoy export)
+ # Multiline messages are preserved by joining lines back before splitting.
if self.lines and self.lines[0].startswith('signmessage '):
raw = '\n'.join(self.lines)
parts = raw.split(' ', 2)
+
if len(parts) != 3 or not parts[2].startswith('ascii:'):
await ErrorPage('{} format is invalid.'.format(err_label)).show()
self.set_result(None)
@@ -33,7 +37,17 @@ async def validate_lines(self):
self.subpath = parts[1]
self.text = parts[2][len('ascii:'):]
+ (subpath, error) = validate_sign_text(self.text, self.subpath)
+
+ if error is not None:
+ await ErrorPage(text=error).show()
+ self.set_result(None)
+ return
+
+ self.subpath = subpath
+
derived = get_addr_type_from_deriv(self.subpath)
+
if derived is not None:
self.addr_type = derived
else:
@@ -48,14 +62,14 @@ async def validate_lines(self):
if len(self.lines) == 3:
self.addr_type = get_addr_type_from_string(self.lines[2])
- # Validate
- (subpath, error) = validate_sign_text(self.text, self.subpath)
- if error is not None:
- await ErrorPage(text=error).show()
- self.set_result(None)
- return
+ (subpath, error) = validate_sign_text(self.text, self.subpath)
+
+ if error is not None:
+ await ErrorPage(text=error).show()
+ self.set_result(None)
+ return
- self.subpath = subpath
+ self.subpath = subpath
# User Interaction for non-health check signing
if self.normal_signing:Why this scored 44/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.