NWC: a relay can forge a wallet's response

Aperta
#698 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

Start with send_request in rust/src/nwc/client.rs and trace how it filters, decrypts, and matches response events to requests. Check the NWC URI fields and existing tests or callers before changing behavior. Done means responses are accepted only when signed by the wallet and referencing the request, so forged and unrelated responses are rejected.

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

Descrizione

The NWC client takes the first kind 23195 event it can decrypt as the wallet's answer (send_request in rust/src/nwc/client.rs). It decrypts with the event's own author (event.pubkey), not with the wallet's key, and checks neither the author nor the request id. The relay's .author() filter is the only guard, and a relay can ignore it.

So a relay can sign a response with its own key and encrypt it to the client's public key, which is visible as the author of every request. The client accepts it: for example a make_invoice result carrying the attacker's invoice, which the buyer's screen then submits to Mostro. An answer meant for another request on the same connection is accepted the same way.

Proposal: decrypt with the wallet's key from the URI, and accept only responses signed by the wallet that reference the request. @grunch found this while reviewing #650; this issue splits it out as its own fix.

Lingua principale
Dart
Stelle
11
Fork
9
Merge medio
14h 3m
PR unite (30g)
135

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 MostroP2P/app

Tutte le issue di MostroP2P/app

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.