NIP-46 transport matches responses by request id only — no binding to the peer the request was sent to #59
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
src/daemon/nip46/transport.ts:82-84resolvesthis.pending.get(body.id)for any verified, decryptable event carrying a matchingid, regardless ofevent.pubkey;parseEnvelopehasremotePubkeyin hand butonEventnever compares it to the admin pubkey thesendRequest(:125-149) was addressed to.admin/index.ts:452-468then feeds the first answer intorequestPermissionResponse, whosealwaysbranch writes a permanentallowAllRequestsFromKeygrant. Same shape on the client:src/nip46-client.ts:52-59decrypts under the sender's key and resolves bymsg.id, and:63-66shows any id-matching sender'sauth_url. Request ids are 10 base36 chars fromMath.random(transport.ts:133).Impact: a non-admin who can predict or learn a pending ACL request id can approve a signing request the operator never saw, within the 10 s window; on the client, any pubkey can forge an
ack/signed-event/phishingauth_url. Practical difficulty is real (the id travels only inside a nip44 envelope to the admin), which is why the transport review parked this as low (#52 CL-3/CS-5, AD-5/CS-1); the sandbox rates it high because the fix is a one-line check on an authorization path. Decide severity, but fix it either way.Fix direction: store the expected peer pubkey alongside each
pendingentry and drop responses whoseevent.pubkeydiffers; inNip46Clientrequireevent.pubkey === this.remotePubkey; generate ids fromcrypto.randomBytes.Found during reforge run #1 (sandbox nsecbunkerd#18). Supersedes the deferred items in #52.