Bounty
XE-13106 · Bounty

Recovery phrase: BIP39 passphrase NFKD is Unicode-version-skewed — Go and the JS tools silently derive different accounts for passphrases containing post-Unicode-15 characters

Triaging claimed High web filed 2026-11-14 16:47 UTC by xe:352fe8fc

Report

Summary

XE's recovery-phrase derivation applies NFKD to the BIP39 passphrase when building the PBKDF2 salt, but neither the spec nor the implementations pin a Unicode version, and the official implementations bundle different Unicode data. For any passphrase containing a character that was assigned a decomposition mapping after Unicode 15.0, the Go CLI derives a different account from the same phrase + passphrase + account index than the web wallet and the TypeScript SDK — silently, with no error on either side. 57 codepoints are affected today (listed below); the set is guaranteed to drift as Unicode and dependencies evolve.

Root cause

docs/recovery-phrase.md:13 specifies the BIP39 seed salt as mnemonic followed by NFKD(BIP39 passphrase), with no Unicode version. The implementations resolve "NFKD" against different data:

  • Go: core/recovery_phrase.go:99 computes the salt as "mnemonic" + norm.NFKD.String(passphrase) using golang.org/x/text v0.33.0 (go.mod:15). That release's normalization tables are Unicode 15.0.0 (the newest tables file in the module is unicode/norm/tables15.0.0.go, Version = "15.0.0").
  • Web wallet: web/assets/recovery-phrase.js:71 uses passphrase.normalize('NFKD') — the host browser engine's Unicode data (current engines ship Unicode 16/17 data).
  • SDK: sdk/src/recovery-phrase.ts:76 delegates to @scure/bip39's mnemonicToSeedSync, which likewise uses the host engine's String.prototype.normalize.

A codepoint unassigned in Unicode 15.0.0 has no decomposition in Go's tables and is passed through unchanged; the same codepoint in a Unicode 17 engine is decomposed before the salt is hashed. Different salt → different BIP39 seed → different SLIP-0010 leaf key → different address.

Affected codepoints (57, exhaustive)

Verified by comparing NFKD over every codepoint U+0000–U+10FFFF between golang.org/x/text v0.33.0 and a Unicode 17 engine (Node 24 / ICU 78.3; Bun's JavaScriptCore gives byte-identical results). These 57 are the complete current set — every one is unassigned in Unicode 15.0.0 and assigned with a decomposition in Unicode 17.0.0 (checked against the official UnicodeData.txt of both versions):

  • U+A7F1 MODIFIER LETTER CAPITAL S — decomposes to S
  • U+105C9, U+105E4 (Todhri letters)
  • U+11383, U+11385, U+1138E, U+11391, U+113C5, U+113C7, U+113C8 (Tulu-Tigalari)
  • U+16121–U+16128 (Gurung Khema vowel signs)
  • U+16D68–U+16D6A (Kirat Rai vowel signs)
  • U+1CCD6–U+1CCF9 OUTLINED LATIN CAPITAL LETTER A–Z and OUTLINED DIGIT ZERO–NINE — decompose to the corresponding ASCII A–Z / 0–9

Reproduction (local, test vectors only)

Differential tester (attached) drives the real implementations: Go core.KeyPairFromPhrase, the web wallet's seedFromPhrase + loadKeyPair, and the SDK's Wallet.fromPhrase, all fed the fixture phrase abandon ×23 + art at account 0. One-command repro: run repro.sh from the attached PoC (builds the Go lane against the pinned clone, runs all three lanes).

passphrase = U+1CCD6 alone (OUTLINED LATIN CAPITAL LETTER A)
  Go CLI core : a20534508ae1ae528983eb52c52c687ec207eaf840ba040707f8bcbc1ddfb04c
  Web wallet  : c9efab74a3b507b2c47079e5d7d93bc39b4c728aca13338f557f12befe920853
  SDK         : c9efab74a3b507b2c47079e5d7d93bc39b4c728aca13338f557f12befe920853

passphrase = "hunter2" + U+1CCE9 (OUTLINED LATIN CAPITAL LETTER T)
  Go CLI core : 60796a16848e5195224cd9bc242dbd29aea530bb8ff4c6d980c6e3dec8b6cb64
  Web wallet  : ff14d7728478b845036f3768c1cf9f1e495d2cbbefa6903d741d493972199195
  SDK         : ff14d7728478b845036f3768c1cf9f1e495d2cbbefa6903d741d493972199195

passphrase = U+105C9 alone (TODHRI LETTER EI)
  Go CLI core : f1964374bb9896ee7a1d5863cf607fab2e8503f2de4239ae1d6d986f0b693b35
  Web wallet  : 6b2cbfa9ad3549e028495b611da331cbedd01632971e032333e4bbac1406b15c
  SDK         : 6b2cbfa9ad3549e028495b611da331cbedd01632971e032333e4bbac1406b15c

control — passphrase = "hunter2T" (plain ASCII)
  Go = Web = SDK = ff14d7728478b845036f3768c1cf9f1e495d2cbbefa6903d741d493972199195

All 12 cluster representatives tested (outlined letters/digit, modifier S, Todhri ×2, Tulu-Tigalari ×2, Gurung Khema ×2, Kirat Rai ×2) diverge identically; the control and a 96-case cross-implementation matrix (accounts 0…2³¹−1, phrase lengths 12–24, ordinary Unicode passphrases) agree everywhere else.

Impact

  1. Stranded funds on cross-tool restore. A passphrase-protected wallet created in the web wallet or via the SDK restores to an empty account in the Go CLI (and vice versa) whenever the passphrase contains one of the 57 characters. Nothing reports an error; the documentation's own warning that "a wrong passphrase opens a different, empty account" (docs/recovery-phrase.md:36) leads the user to blame their backup.
  2. Implementation-defined collisions. Inside the JS tools, the passphrase hunter2 + U+1CCE9 opens the same account as hunter2T (see repro); in Go those are two different accounts. Which backups collide depends on which tool derives them.
  3. Structural drift. Because the spec does not pin a Unicode version, every future Unicode release, browser update, or x/text bump can silently move accounts for new character sets, in either direction.

Reachability, stated plainly: the affected characters are new (Unicode 16, 2024; Unicode 17, 2025) and uncommon in passphrases today. The realistic carriers are a passphrase written in Todhri, Tulu-Tigalari, Gurung Khema or Kirat Rai — scripts encoded in Unicode 16 for living speaker communities — and outlined/"fancy text" characters pasted into a passphrase. The bug is in the specification surface, not in any one character: it will recur with new characters even if these 57 are special-cased.

The phrase path is not affected: the same characters inside a phrase word are rejected as unknown words by all three implementations (verified).

Suggested fix

Pin the normalization data in the spec and conformance vectors: state the Unicode version of NFKD that derivation is defined against (e.g. "NFKD as of Unicode 15.0.0") in docs/recovery-phrase.md, ship shared test vectors whose passphrases contain post-15.0 characters for every implementation, and either (a) bring Go's x/text and the JS guidance to that pinned version, or (b) reject, identically in all three implementations, passphrase characters that are unassigned in the pinned version, so a backup that derives in one tool can never silently derive differently in another.

Dedupe

  • XE-6618 (web) and XE-6994 (SDK): the U+0130 (İ) lowercasing difference makes a phrase valid in the CLI and rejected in JS — a case-mapping difference in the phrase path with a loud-rejection failure mode. This report is a decomposition (NFKD) difference in the passphrase path whose failure mode is silent derivation of a different key. Different primitive, different input surface, different failure mode; both bodies were read in full.
  • Corpus sweeps (fresh desk corpus, 2,027 tickets, 2026-11-14): title greps for phrase|mnemonic|bip39|slip|deriv|seed|NFKD|normal|unicode|passphrase and full-text greps for nfkd|decompos*|unicode version|x/text|outlined|todhri|tulu|gurung|kirat return no ticket about NFKD data versions or decomposition skew. Neighbours with different mechanisms: XE-8556 (SDK rejects uppercase hex), XE-6895 (web malformed-hex prefix parse), XE-10788 (CLI restore input handling), XE-12464 (hosted-wallet UI checkbox), XE-0038 (CRLF wordlist bytes).

Thread

xe:352fe8fc2026-11-14 16:47 UTCweb

Attachment packaging note: the desk caps a ticket at 5 attachments, so the PoC set was packaged as follows. Attached individually: repro.sh (the one-command reproduction), vectors2.json, go/main.go, js/web.mjs. The remaining manifest files are inside keys2-poc-bundle.tar.gz (attachment 5), which contains the complete PoC tree named in the report: gen_vectors2.py, go/go.mod, js/sdk.mjs, out/go2.jsonl, out/web2.jsonl, out/sdk2.jsonl, scan_diff.py, out/scan-go.tsv and out/scan-node.tsv, plus copies of the four individually attached files. All 13 manifest files are therefore on this ticket; every attachment's size was verified against the local originals after filing.

Joseph Denneteam2026-11-20 19:45 UTCdesk

Thanks for the report. We have read it against the code and it is being handled. We will update this ticket when there is news. https://bounty.xe.network/XE-13106