fix litecoin renaming issue
What changed, and why it matters
This commit fixes a bug in the Cake Wallet Litecoin wallet where, when renaming a wallet, stored MWEB (a privacy feature for Litecoin) transaction records were being copied to a new storage box by reusing the exact same object references. The fix explicitly creates fresh copies of each record during the rename. Without the fix, the app might have shared object state between the old and new wallet boxes, which could lead to data corruption or inconsistent wallet state after a rename. There is no direct evidence this is exploitable by an attacker.
Treat as a routine bug-fix commit. Review whether the same object-reference reuse pattern exists in other wallet migration paths. No urgent security response is indicated by the diff alone.
Security signals we found
Data migration now clones objects instead of sharing references
Prevents potential state corruption when renaming Litecoin wallets
No explicit input validation or cryptographic change present
Evidence from the diff
In cw_bitcoin/lib/litecoin_wallet.dart, the _migrateMwebUtxos method previously copied MwebUtxo entries from an old Hive box to a new one by calling newBox.put(key, oldBox.get(key)!). This passes the same object instance into both boxes. The patch changes this to construct a new MwebUtxo for each entry, copying all fields individually. This prevents unintended shared mutable state between the old and new boxes during wallet renaming. The change is a defensive data-integrity fix; no explicit security vulnerability or attacker-controlled input path is visible in the diff.
Changed components
cw_bitcoin/lib/litecoin_wallet.dartLitecoin MWEB UTXO storage migrationInspect captured patch +12 / −1
### cw_bitcoin/lib/litecoin_wallet.dart
@@ -507,7 +507,18 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
final oldBox = await CakeHive.openBox<MwebUtxo>(oldBoxName);
final newBox = await CakeHive.openBox<MwebUtxo>(newBoxName);
for (final key in oldBox.keys) {
- await newBox.put(key, oldBox.get(key)!);
+ final utxo = oldBox.get(key)!;
+ await newBox.put(
+ key,
+ MwebUtxo(
+ height: utxo.height,
+ value: utxo.value,
+ address: utxo.address,
+ outputId: utxo.outputId,
+ blockTime: utxo.blockTime,
+ spent: utxo.spent,
+ ),
+ );
}
}
Why this scored 23/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.