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
cache: hash-mismatch handler permanently evicts the *actual* hash — a malicious upstream can durably censor any blob it holds the bytes of #853
kind:bugSomething does not behave as documentedkind:securitySecurity impact; report a vulnerability to [email protected], not hereprio:highNext uprustDependabot: a Cargo update; use area: labels for Rust code otherwise
Severity: HIGH — from the 2026-06-10 full-repository review.
Location
crates/cache/src/engine.rs:1807 (streaming path) and :1882 (drain path) — on a hash mismatch, the engine calls self.evict(actual).
Problem
evict(actual) adds the actual (correctly computed) hash to the logical-evicted set, which is fsync-persisted to <cache_dir>/evicted.log and is sticky for the life of the file with no unevict path — get/has/populate all return absent for it forever, surviving restart.
For content-addressed storage this is logically unsound: bytes whose BLAKE3 is actualare the authorized content for actual. The eviction provides zero poisoning protection (the requested hash H is correctly never committed) but inflicts a permanent denial on actual.
Attack
With the node-to-node Peer origin (#831/#834), a malicious upstream answers any cache-miss pull routed to it with the bytes of a victim blob A it possesses. The victim requested H, computes actual = A != H, and permanently blacklists A. The attacker censors any blob it holds the preimage of, on any node that pulls through it — cheaply and durably.
Secondary impact: each event grows evicted.log and burns the in-memory cap toward MAX_EVICTED_ENTRIES (after which legitimate DMCA evicts fail with EvictionLimitExceeded), plus a blocking sync_all per event (the latter already noted in #845/#837).
Not a duplicate
#837/#835 cover the wrong-hash bytes (GC-unreclaimable disk growth / transient serveability). This is the inverse: evict(actual) durably censors the legitimate hash itself — a serve-denial vector.
Fix direction
Drop the evict(actual) call entirely (content-addressing already makes serving actual's bytes for actual correct), or scope the cleanup to dropping the temp/named tag for the partial without touching the persisted evicted set. At minimum, never persist mismatch-derived hashes to evicted.log.
A HIGH-severity logic inversion in the hash-mismatch cleanup path: when received bytes don't match the requested hash H, the engine calls evict(actual) — permanently blacklisting the correct hash for actual's own bytes. With the peer-origin pull path live (#831/#834), a malicious upstream can durably censor any blob it holds by feeding its bytes as a wrong-hash response, causing the victim node to evict the victim blob forever. The fix direction is clear and well-scoped: stop calling evict(actual) on mismatch, only clean up the partial for GC eligibility.
Peer-origin pull path (#831/#834) is PoC-scope and this is a direct attack vector against it
Coding agent
Suitable
Two-line call-site fix with a clear semantic: drop evict(actual) at engine.rs:1807 and :1882; replace with tag/GC cleanup only. No design decisions required.
Root cause in one line:evict(H) would be the correct defensive call (never commit mismatched content under the requested hash), but the code calls evict(actual) — blacklisting legitimate content for a hash the node just verified is correct.
Do NOT touch evicted.log with actual — actual is valid, legitimate content.
Recommended implementation approach:
Introduce a unified reject_mismatch(partial_tag_or_handle) helper that handles GC eligibility (drop tag) without touching the evicted set. Call it from all three wrong-hash paths (streaming HashMismatch, streaming captured-error, drain HashMismatch) to close this issue and #837/#835 together without further drift.
Secondary concern (from #845):evict() currently does a blocking sync_all() on the async runtime at engine.rs:878-928, :1737, :1812. Once the evict call is removed from the mismatch path, this concern remains for legitimate DMCA evicts — worth moving to spawn_blocking when touching the eviction code.
Checklist for the fix PR:
Remove self.evict(actual) from the streaming-path HashMismatch arm (engine.rs:1807)
Remove self.evict(actual) from the drain-path mismatch arm (engine.rs:1882)
kind:bugSomething does not behave as documentedkind:securitySecurity impact; report a vulnerability to [email protected], not hereprio:highNext uprustDependabot: a Cargo update; use area: labels for Rust code otherwise
Activity
github-actions commentedon Jun 10, 2026
🎯 Triage report
A HIGH-severity logic inversion in the hash-mismatch cleanup path: when received bytes don't match the requested hash
H, the engine callsevict(actual)— permanently blacklisting the correct hash foractual's own bytes. With the peer-origin pull path live (#831/#834), a malicious upstream can durably censor any blob it holds by feeding its bytes as a wrong-hash response, causing the victim node to evict the victim blob forever. The fix direction is clear and well-scoped: stop callingevict(actual)on mismatch, only clean up the partial for GC eligibility.📊 Assessment
poc-blockingadded;bug,security,high,rustalready presentevict(actual)atengine.rs:1807and:1882; replace with tag/GC cleanup only. No design decisions required.🔗 Similar issues
💡 Notes and suggestions
Root cause in one line:
evict(H)would be the correct defensive call (never commit mismatched content under the requested hash), but the code callsevict(actual)— blacklisting legitimate content for a hash the node just verified is correct.Precise fix locations:
engine.rs:1807— streaming pathHashMismatcharm: removeself.evict(actual);engine.rs:1882— drain path mismatch arm: removeself.evict(actual);In both cases the right action is:
H(already correct — this is theH != actualguard).evicted.logwithactual—actualis valid, legitimate content.Recommended implementation approach:
Introduce a unified
reject_mismatch(partial_tag_or_handle)helper that handles GC eligibility (drop tag) without touching the evicted set. Call it from all three wrong-hash paths (streamingHashMismatch, streamingcaptured-error, drainHashMismatch) to close this issue and #837/#835 together without further drift.Secondary concern (from #845):
evict()currently does a blockingsync_all()on the async runtime atengine.rs:878-928,:1737,:1812. Once the evict call is removed from the mismatch path, this concern remains for legitimate DMCA evicts — worth moving tospawn_blockingwhen touching the eviction code.Checklist for the fix PR:
self.evict(actual)from the streaming-pathHashMismatcharm (engine.rs:1807)self.evict(actual)from the drain-path mismatch arm (engine.rs:1882)evicted.logafterwardengine.has(actual)returns true after a mismatch event for a hash that was previously populatableAdd this agentic workflows to your repo
To install this agentic workflow, run
fix: batch of six quick-win review follow-ups (#845 #864) (#868)
fix(cache): separate DMCA eviction from wrong-hash rejection; reclaim…