You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
node: cache-miss pull-through pays upstream for the entire blob before collecting any downstream voucher #856
design:economicsToken economics, pricing, fee split, bond sizingkind:bugSomething does not behave as documentedkind:securitySecurity impact; report a vulnerability to [email protected], not hereprio:mediumScheduledrustDependabot: a Cargo update; use area: labels for Rust code otherwise
The populate runs the full NodeOrigin discover→pull and pays the upstream for the whole blob (stream_fetch buffers and pays to completion) beforedeliver collects the first downstream voucher (client.rs:680)
Scenario
An authorized client (one that proves channel ownership, satisfying pull_authorized) with a near-empty deposit — or one that simply drops the stream right after the fill — makes the node front the full upstream USDC cost while paying back at most one voucher interval (or zero). The node's loss per request is bounded only by max_blob_size_bytes, not by anything the client has at stake. Repeatable across hashes the client knows aren't cached.
Not a duplicate
#848 is an unknown/absent channel (free first interval); here the channel is known and owned — the distinct defect is the prepay-whole-blob-then-recover-incrementally timing asymmetry. #821 is opting out of relaying unclaimed content; #840 is buyer-side memory buffering.
Fix direction
Gate the pull on the owning channel having remaining deposit ≥ the (probed) blob cost, and/or stream-and-forward so downstream voucher collection paces the upstream spend rather than paying it all up front.
Confirmed economic/security vulnerability in the cache-miss pull-through path: a verified channel owner with minimal deposit (or intent to drop the stream) can force the node to fully pre-pay the upstream blob cost via stream_fetch before collecting even one downstream voucher. The node's exposure per request is bounded only by max_blob_size_bytes and the attack is repeatable across any hashes the client knows are uncached. Issue precisely identifies the code locations (client.rs:584-594, :297-298, :680) and two remediation directions.
📊 Assessment
Dimension
Value
Reasoning
Type
Bug
Exploitable timing asymmetry in payment flow — node fronts full upstream USDC cost before any downstream revenue
Labels
bug, technical (added)
Existing security/economics/medium/rust labels accurate; bug for defect classification, technical for implementation scope
Coding agent
Needs more info
Code locus is precise, but two distinct remediation paths (deposit pre-check vs. stream-and-forward) require a design decision before implementation begins
Root cause:client.rs:297-298 calls cache.populate(hash) synchronously (full blob, paid to completion) before the downstream deliver at :680 collects the first voucher. pull_authorized validates channel ownership and existence but does not verify whether the channel's remaining deposit covers the blob cost.
Two remediation paths — pick one:
Pre-flight deposit check (faster, partial mitigation): Before try_pull_through, query the channel's remaining deposit and compare against max_blob_size_bytes as a conservative ceiling (exact size unknown pre-fetch). Reject with InsufficientDeposit if deposit < ceiling. Simple guard; does not close the window for legitimate clients whose deposit is large enough but who drop mid-stream — that's a separate leech-ratio concern.
Stream-and-forward pacing (full fix, larger refactor): Restructure try_pull_through → populate so upstream payment is interleaved with downstream voucher collection — the node only advances the upstream pull after receiving a downstream voucher for the prior interval. Eliminates the timing gap entirely but requires the cache engine to expose a chunk-streaming API rather than buffer-to-completion.
Suggested sub-tasks:
Design decision: pre-flight check vs. stream-and-forward (recommend recording in ADR 037 or a brief amendment)
If pre-flight: add remaining_deposit(&channel_id) -> Option<U256> to the channel store; gate try_pull_through on remaining >= max_blob_size_bytes
If stream-and-forward: expose progressive fetch API on the cache engine; interleave with deliver voucher collection
Interaction with #848: Fixing #848 (reject unknown channel before streaming) does not affect this issue — the channel here is known and valid. The two fixes are complementary; closing both is needed to fully harden the payment flow.
design:economicsToken economics, pricing, fee split, bond sizingkind:bugSomething does not behave as documentedkind:securitySecurity impact; report a vulnerability to [email protected], not hereprio:mediumScheduledrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Activity
github-actions commentedon Jun 10, 2026
🎯 Triage report
Confirmed economic/security vulnerability in the cache-miss pull-through path: a verified channel owner with minimal deposit (or intent to drop the stream) can force the node to fully pre-pay the upstream blob cost via
stream_fetchbefore collecting even one downstream voucher. The node's exposure per request is bounded only bymax_blob_size_bytesand the attack is repeatable across any hashes the client knows are uncached. Issue precisely identifies the code locations (client.rs:584-594,:297-298,:680) and two remediation directions.📊 Assessment
security/economics/medium/rustlabels accurate;bugfor defect classification,technicalfor implementation scope🔗 Similar issues
serve_stream; unknown channel leaks up to 1 voucher interval free, but distinct: absent channel vs. present/owned channel with insufficient depositstream_fetchbuffers to server-claimedtotal_byteswithout a size ceiling; adjacent security bug in the same pull pathrequire_authorized_originequivalent on the cache-miss pull-through path: operators cannot opt out of relaying/warming unclaimed content #821 (related) —require_authorized_origingate missing from pull-through path; overlapping code path but orthogonal concern (content policy, not economic timing)💡 Notes and suggestions
Root cause:
client.rs:297-298callscache.populate(hash)synchronously (full blob, paid to completion) before the downstreamdeliverat:680collects the first voucher.pull_authorizedvalidates channel ownership and existence but does not verify whether the channel's remaining deposit covers the blob cost.Two remediation paths — pick one:
Pre-flight deposit check (faster, partial mitigation): Before
try_pull_through, query the channel's remaining deposit and compare againstmax_blob_size_bytesas a conservative ceiling (exact size unknown pre-fetch). Reject withInsufficientDepositifdeposit < ceiling. Simple guard; does not close the window for legitimate clients whose deposit is large enough but who drop mid-stream — that's a separate leech-ratio concern.Stream-and-forward pacing (full fix, larger refactor): Restructure
try_pull_through→populateso upstream payment is interleaved with downstream voucher collection — the node only advances the upstream pull after receiving a downstream voucher for the prior interval. Eliminates the timing gap entirely but requires the cache engine to expose a chunk-streaming API rather than buffer-to-completion.Suggested sub-tasks:
remaining_deposit(&channel_id) -> Option<U256>to the channel store; gatetry_pull_throughonremaining >= max_blob_size_bytesdelivervoucher collectionregionStats(the same invisibility noted in node: unknown/absent payment channel is not validated before bytes are served — free egress of the first voucher interval #848 for its path — worth fixing alongside)Interaction with #848: Fixing #848 (reject unknown channel before streaming) does not affect this issue — the channel here is known and valid. The two fixes are complementary; closing both is needed to fully harden the payment flow.
Add this agentic workflows to your repo
To install this agentic workflow, run
thiras commentedon Jun 13, 2026
Follow-ups split out of the #893 review (non-blocking, deferred from that PR):
LeechCapsconfusion seamnode_pull_through_tee_finalize_failed)fix(node): address PR #893 review round 2 (deposit-guard doc, error s…
Merge origin/main into fix/856-window-paced-pull-through
fix(node): address PR #893 review round 3 (#856)
feat(node): window-paced pull-through for regional proxy warming (#856)…
docs(adr): add ADR 038 — bao verified-range streaming on cdn/client/v1
docs(adr): add ADR 038 and 039 — verified-range streaming and multi-s…
fix(cache,adr): address PR #961 review — total_bytes semantics, Bytes…
feat(cache,protocol): range origin pull-through — ADR decision + bao …
feat(node): refuse a stream when the deposit cannot cover the first c…
feat: enforce the seller-side deposit floor before serving, drop the …
refactor(incentive): remove unenforceable client-reputation ledger (#…
fix(node,protocol): close the #1828 review findings on the zero-copy …
perf(node,protocol): zero-copy ChunkData framing via vectored QUIC wr…