audit: swap-fee math silently contributes 0 ppk for proofs on keysets unknown to the wallet's view (PoC reproduced; fix in gonuts-tollgate)

Aperta
#832 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go
Ambito
payments, security

Direzione di ricerca

The bug is in feesForProofs in wallet/wallet.go of the gonuts-tollgate fork (around lines 1934-1944), which adds 0 ppk for proofs whose keyset id is neither active nor in inactiveKeysets. The below-fee refusal in merchant.go (around line 1539) depends on that figure. Start by reproducing with proofs carrying unknown keyset ids, then choose refuse or worst-case counting. Done means an unknown keyset never yields a silent zero fee. The fork is not on this tracker and the design choice is open, so confirm the approach with maintainers first.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

From the 2026-10-09 Cashu audit. PoC reproduced against fork d7591d2. Fork-first fix, tracked here (issues disabled on the fork).

Finding

Fork wallet/wallet.go feesForProofs (≈:1934-1944): a proof whose keyset id is neither the active keyset nor in inactiveKeysets adds 0 ppk silently — no error, no refusal.

cashu.Proofs{{Id:"00rotated-away",…},{Id:"00never-seen",…}} → feesForProofs = 0, nil

Path

When the mint's keyset listing prunes/hides the keyset a token's proofs carry (hostile mint, aggressive rotation), the wallet underestimates the fee → the below-fee refusal (merchant.go:1539) never fires → the swap consumes the whole note. Same family as #752's fee edges.

Minimal fix

Unknown keyset in the fee path = refuse (or count worst-case), never silently zero. CWE-682. Severity MEDIUM-LOW (precondition: mint stops listing a still-swappable keyset).

Cross-refs: #703, #752.

Lingua principale
Go
Stelle
12
Fork
14
Merge medio
4g 19h
PR unite (30g)
213

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenTollGate/tollgate-module-basic-go

Tutte le issue di OpenTollGate/tollgate-module-basic-go

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.