Skip to content

node: the per-stream credit floor is free, with no cross-stream debt, so a client can download without ever paying #2767

Closed

Description

@yigitdot

Problem

The node keeps no memory of unpaid delivered bytes across streams. Every stream opens with a free credit floor, and nothing bounds how many streams a never-paying client opens in sequence.

  • crates/node/src/handlers/client/mod.rs:2270-2277 — credit_window at paid = 0 returns the floor: one voucher interval (CHUNK_BYTES = 1 MiB, crates/protocol/src/client.rs:56) plus VERIFY_LAG_BYTES (16 KiB, crates/client/src/pacer.rs:57).
  • crates/node/src/handlers/client/delivery.rs:370 and serve_leg.rs:344 — that window opens every stream.
  • crates/node/src/handlers/client/mod.rs:544-555 — FloorReservation's drop releases the reservation with no surviving charge: "bounding un-vouchered floor is the admission-time job of the pool ceiling and the per-signer live cap". Those two gates bound concurrent floors only, never sequential ones.

Attack

A client with any working lane (own pool with a tiny deposit, self-signed binding, own capability):

  1. Request byte_offset = k·1 MiB, byte_len = 1 MiB. The whole range fits the opening window, so the node sends all of it.
  2. Never pay. Reset the stream, move to k+1.

The pool is never debited, so the deposit stays fully reclaimable. The only brake is the per-peer request rate limit — and peer NodeIds cost nothing, and the per-source/per-IP layers do not bind relay-only connections (#2505). On a cache miss it is worse: the window pull-through path (crates/node/src/handlers/client/window.rs) pays the upstream node real USDC for the window before the client pays anything, so the victim loses buyer funds on every request.

ADR 003 §Credit window states "a payer that abandons stream after stream gets no more unpaid bytes than the paid total allows". That claim is false at paid = 0, where the floor is granted per stream for free.

Fix

  • Track unpaid-delivered bytes per lane (and per signer) across streams; while debt is outstanding, shrink or refuse the floor, or require the debt paid at the next admission
  • Loopback test: a never-paying client that opens streams in a loop gets a bounded cumulative free-byte total
  • Reconcile the ADR 003 §Credit window claim with the implemented bound

Activity

  1. added
    kind:security
    prio:high
    area:node
    area:payments
    on Oct 30, 2026
  2. assigned and unassigned on Oct 30, 2026
  3. moved this from Backlog to In progress in deCDNon Oct 30, 2026
  4. moved this from In progress to Done in deCDNon Nov 1, 2026
  5. added a commit that references this issue on Nov 3, 2026
    ca1a965
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:nodearea:paymentskind:securityprio:high

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions