Priority: P2 — NUT-13 residue-collision guard is dead code in gonuts v0.13.0 (Conduition disclosure): CheckCollidingKeysets never invoked; wallet-level fix belongs in gonuts-tollgate, tracked here
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start by tracing keyset registration and persistence in AddMint, keyset refresh, and restore, then locate CheckCollidingKeysets and the existing SaveKeyset guard. The issue requires checking every registration path and adding tests for collisions, unaffected non-colliding registration, rotation, and partial-state prevention; done means collisions are refused before state is written. The proposed keyset-ID verification also needs validation against the applicable ID variants.
索引モデルが issue の本文から書いたものです。
説明
What (all refs at tag v0.13.0)
The deterministic-derivation implementation is exactly the BIP32 shape the Conduition NUT-13 disclosure (https://conduition.io/code/cashu-disclosure/, 2026-01, bounty-paid) describes as attackable, and the mitigation that already exists in this repo is never invoked:
cashu/nuts/nut13/nut13.go:24,40— the keyset ID is reducedmod (2^31 - 1)tokeyset_id_intnut13.go:51-63— pathm/129372'/0'/keyset_id_int'nut13.go:94-116/:72-75—DeriveSecret=.../counter'/0,DeriveBlindingFactor=.../counter'/1nut13.go:119-143—CheckCollidingKeysets(currentKeysetIds, newMintKeysetIds)implements precisely the disclosure's short-term fix (refuse keysets whose2^31 - 1residues collide; also refuses exact duplicate IDs across mints) — and a grep across the whole module (wallet, mint, cmd, tests) finds zero call sites. Dead code.- No wallet-path verification that a mint-fetched keyset ID actually derives from the mint's published keys (
DeriveKeysetId) — only per-proof DLEQ checks, which do not constrain the ID.
Why it matters
Per the disclosure: a malicious mint can pick a keyset ID whose 31-bit residue collides with a target mint's; a wallet that transacts with both then derives the same secrets and blinding factors for both keysets, and the malicious mint can use the target mint's NUT-09 /restore endpoint as an oracle to harvest blind signatures and construct valid proofs at the target mint. Most NUT-13 wallets were affected; the short-term fix advised for every wallet is exactly the collision guard this repo already has, unwired.
TollGate-side exposure (context from OpenTollGate/tollgate-module-basic-go#703 item 7): mints are operator-curated (accepted_mints + trust allow/blocklists) and the daemon does not auto-transfer between mints, so the no-user-interaction variant does not apply. The realistic vector is an operator running an untrusted mint alongside an honest one. Moderate severity; not a release blocker; the wiring is small.
Proposed fix
- Wire the existing guard into every keyset-registration writer —
AddMint, keyset refresh, and restore: before persisting a new keyset, runCheckCollidingKeysetsagainst all already-registered keysets; on collision, refuse registration with an error naming both mints and both IDs. This follows the same pattern as theSaveKeysetmonotonic-counter guard (the #480/#496 writer-audit class: a guard that exists must be on every writer's path). - Cheap hardening: verify mint-fetched keyset IDs against
DeriveKeysetId(pubkeys)where the ID variant permits, rejecting forged IDs at registration. - Explicitly not proposed now: switching derivation to the disclosure's long-term fix (single HMAC over full keyset ID + counter, no BIP32 path). That changes every derived secret and silently invalidates determinism for existing wallets' counter ranges — it needs a versioned derivation plus a migration design, not a patch. Note also that V2 keyset IDs alone do not fix this:
keysetIdToBigIntfunnels V2 IDs through the same2^31 - 1residue.
Required tests
- Registering a second mint with a residue-colliding keyset ID → refused, error names both mints/IDs.
- Non-colliding multi-mint registration unaffected.
- The collision check runs before any counter or derivation state is written (registration refusal leaves no partial state).
- Keyset rotation/refresh that produces a colliding ID → refused.
- An attacker-chosen ID that does not hash to the mint's published keys → rejected by the verification in fix 2.
References
- Disclosure: https://conduition.io/code/cashu-disclosure/
- Short-term/long-term fix definitions quoted in the disclosure ("Improving security of keyset IDs", "keyset ID v2")
- TollGate tracking: OpenTollGate/tollgate-module-basic-go#703 (fund-safety program, deep-dive item 7), #665 (pre-tag readiness — this audit's report)
- Amperstrand/cashu-audit — divergence database context
- 主要言語
- Go
- スター
- 12
- フォーク
- 14
- 平均マージ
- 1日 6時間
- マージ済み PR(30日)
- 217
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OpenTollGate/tollgate-module-basic-go のほかの issue
-
go-battery needs an ndsctl on PATH: TestPurchaseSessionGuardHoldsThroughTheOutcomeUnknownWindow fails on bare hosts (passes with stub)対応中かも @Amperstrand が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenTollGate/tollgate-module-basic-go#726 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
rebrand-literal-gutter: uhttpd section-vocabulary check trips on a COMMENT (uhttpd.luci in 92-tollgate-admin-setup:178)対応中かも @Amperstrand が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenTollGate/tollgate-module-basic-go#723 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
OpenTollGate/tollgate-module-basic-go#768 ·
メンテナーはふだん 1 日以内に返信
-
Four drift fences for tests/contract/ (+ test.yml clean-container lane + pre-commit wiring)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
OpenTollGate/tollgate-module-basic-go#767 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
OpenTollGate/tollgate-module-basic-go#763 ·
メンテナーはふだん 1 日以内に返信
OpenTollGate/tollgate-module-basic-go の issue をすべて見る
似ている issue
-
proxy logs "no user in context" at error level for every data gateway download対応中かも @paul43210 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
txn2/mcp-data-platform#2063 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 83/100
kubernetes-sigs/kueue#16990 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
enhancement exporter/awss3 needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
open-telemetry/opentelemetry-collector-contrib#51905 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信