AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
High 81 Bitcoin

Check change derivation paths against the inputs

Public commit record

What the developer wrote

Authored by kdmukai

85/100 · Strong
Check change derivation paths against the inputs

An output is shown as change once our key is proven in its script, but
its derivation path is still the psbt's claim. Change at a path the
user's wallet never scans is ours yet lost to the coordinator. Change
must now come back to the base path of one of our verified inputs, on
the receive or change branch, at a non-hardened address index, with
the path long enough to hold both. Other change raises
PSBTChangeDerivationPathError, graded an attack. The same rules cover
multisig outputs counted as spends because their cosigners differ from
the inputs' or fail to resolve.

An address index more than CHANGE_ADDRESS_INDEX_WINDOW past the largest
index our inputs spend from at that base path is flagged, not refused,
since an active wallet can trip it. The change details screen marks the
output and PSBTWarningView shows one distant address warning.

Held input findings are now raised before these rules and held output
findings after them. An input set aside by a held finding leaves its
base path out of the rules, while a held output is already a spend.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit adds a safety check to SeedSigner that refuses to sign a Bitcoin transaction if the change output is being sent to a derivation path the user's wallet is unlikely to scan. Before this change, an attacker could trick a user into signing a transaction where the coins technically still belong to the user but are sent to an unusual path (for example, a different account, a non-standard branch, or a hardened address index), making them effectively lost or hard to recover. The update also warns the user if the change address index is unusually far ahead of the addresses being spent from. The commit includes new error screens, warnings, and extensive tests.

Recommended action

Review the new derivation-path rules for compatibility with your wallet's change and self-transfer patterns. Ensure the CHANGE_ADDRESS_INDEX_WINDOW of 10,000 is sufficient for active wallets, and consider whether the TODO about honest transfers to another owned wallet should be addressed in a follow-up. Run the new test suite to confirm no regressions in payjoin, coinjoin, or multisig flows.

Security signals we found

01

New attack-level exception PSBTChangeDerivationPathError for change sent to an unscanned derivation path

02

New warning WARNING__CHANGE_ADDRESS_INDEX_BEYOND_WINDOW for change address indices far past spent indices

03

New UI screen PSBTUnexpectedChangeDerivationPathView with DireWarningScreen and forced discard

04

Change details screen now marks distant address indices with a warning icon

05

Extensive new unit and flow tests covering single-sig, multisig, payjoin, coinjoin, and edge cases

Risk score

Why this scored 81/100

Our methodology →
Potential impact 24/30
Exploitability 18/25
Stealth signal 12/15
Affected reach 13/15
Confidence 9/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.