AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 49 Monero

Shuffle change output on hardware wallet and Bitcoin Cash sends (#3432)

Public commit record

What the developer wrote

Authored by Cindy

81/100 · Strong
Shuffle change output on hardware wallet and Bitcoin Cash sends (#3432)

* Shuffle change output on hardware wallet sends

Hardware wallet BTC/LTC sends passed outputs to the PSBT/device in the
given order (change last), a position fingerprint. The outputOrdering
param was plumbed but ignored. Add orderOutputs() and apply it in both
buildHardwareWalletTransaction paths; set the send call site to shuffle.

Refs #3376 (the software send + RBF paths were covered by #3420).

* Shuffle change output on Bitcoin Cash sends

The BCH send path built via ForkedTransactionBuilder with
outputOrdering: none, leaving change deterministically last. The builder
shuffles natively and change is found by isChange, not position, so flip
it to shuffle (matches the BTC software path from #3420).

Refs #3376.

* Update cw_bitcoin/lib/electrum_wallet.dart

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes a privacy weakness in Cake Wallet's Bitcoin, Litecoin, and Bitcoin Cash sending flows. Previously, when using a hardware wallet or sending Bitcoin Cash, the app's own 'change' output was always placed last in the transaction. That predictable ordering acts like a fingerprint, making it easier for outside observers to identify which output belongs to the sender and trace the user's funds. The patch shuffles output order so the change output no longer sits in a fixed, telltale position.

Recommended action

No immediate user action required; this is a privacy-hardening fix. Users on affected versions who made recurring hardware-wallet BTC/LTC or BCH transactions may have leaked change-output position; updating to the patched version removes the fingerprint going forward. Reviewers should confirm that all other coin send paths (e.g., software BTC/LTC, PayJoin, Lightning) already use shuffle or otherwise hide change position, and that the hardware signer UI still displays outputs correctly after shuffling.

Security signals we found

01

privacy fingerprint: change output placed deterministically last

02

output ordering parameter was plumbed but ignored on hardware wallet paths

03

Bitcoin Cash send path used BitcoinOrdering.none, leaving change last

04

patch adds deterministic shuffle helper with secure default RNG

05

unit test explicitly models change output and verifies non-deterministic position

06

cross-references issue #3376 and prior PR #3420

Risk score

Why this scored 49/100

Our methodology →
Potential impact 12/30
Exploitability 5/25
Stealth signal 12/15
Affected reach 8/15
Confidence 8/10
Evidence quality 4/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.