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

fix old migration issues (#3761)

Public commit record

What the developer wrote

Authored by Omar Hatem

86/100 · Strong
fix old migration issues (#3761)

* fix old migration issues

* fix: trust the wallet file's derivation type before the mnemonic

resolveUnknownDerivation let the mnemonic override a type the wallet file
had explicitly recorded. _validateWalletInfoBoxData re-creates WalletInfo
rows without a derivation on every launch, so an Electrum-stretched wallet
restored from a BIP39 phrase re-opened as bip39 and persisted it.

Precedence is now: the type recorded in the wallet file (electrum/bip39),
then the type the mnemonic proves, then the pre-existing fallback. Files
that predate derivation tracking load as electrum, which every such wallet
used.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* test: cover resolveUnknownDerivation precedence and defaults

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes a bug in Cake Wallet where the app could misidentify how a wallet's keys are derived. Specifically, when reopening a wallet, the app sometimes recreated the wallet's metadata row without its saved derivation type, then let the mnemonic phrase override the type that the wallet file had explicitly recorded. That could cause an Electrum-stretched wallet (restored from a BIP39 phrase) to be reopened as a BIP39 wallet and persisted that way, potentially deriving different addresses than before and making existing funds appear missing. The fix gives precedence to the type recorded in the wallet file, then to what the mnemonic proves, then to a safe fallback. It also ensures an empty derivation path is treated as missing rather than as the master key itself.

Recommended action

Treat this as a correctness and reliability fix with possible security-adjacent impact (fund accessibility). Users who created or restored Bitcoin/Litecoin wallets between the affected migration versions (noted v5.6.0–v5.6.4) and observed missing balances or wrong addresses should verify their wallet derivation type/path. The project should consider whether any wallets were persisted with the wrong type before this patch and whether a migration/repair path is needed. No immediate remote-exploitation vector is evident.

Security signals we found

01

Incorrect derivation-type assignment could switch a wallet to a different address chain, causing apparent or real loss of access to funds.

02

Wallet metadata recreation on every launch (`_validateWalletInfoBoxData`) stripped the recorded derivation type, creating a window for the mnemonic to override the file's type.

03

Empty-string derivation path was previously persisted, which would derive addresses from the master key instead of a standard account path.

04

Fix explicitly prioritizes wallet-file recorded state over mnemonic inference, reducing trust in user-supplied/recoverable secrets for type selection.

05

No explicit CVE, advisory, or vendor security disclosure is present in the commit or supplied references.

Risk score

Why this scored 59/100

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