{"id":"XE-0126","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"202","source_url":"https://github.com/xeprotocol/xe/issues/202","reporter_id":39,"title":"net/banstore: FIFO 4096 ban table is flushable with 4096 throwaway identities — a live 24 h ban on a real offender is evicted","area":"p2p-sync","claimed_tier":"minor","assessed_tier":null,"verdict":null,"duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":null,"status":"triaging","closed_reason":null,"github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-10-29T16:53:40.540419+00:00","updated_at":"2026-11-08T20:17:41.885067+00:00","source_created_at":"2026-10-29T16:51:39+00:00","told_at":"2026-11-08T20:18:50.365262+00:00","status_changed_at":"2026-11-08T20:18:36.366391+00:00","url":"https://bounty.xe.network/XE-0126","body":"**Suggested severity: Low (1,300 XE)**\n**Area:** `net/banstore.go`\n**Repo pin:** 9787859 (testnet-0005)\n\n## Summary\n\nThe ban list is a bounded FIFO (4096). When it is full, the oldest ban is evicted to make room:\n\n```go\n// net/banstore.go:129-141\nfor len(s.entries) >= s.max {\n\tif !s.evictOldestLocked() { break }\n}\n```\n\nBans are added by `netcheck` rejections, and an attacker controls how often those happen: one connection attempt with a fresh peer ID and a wrong answer is enough to earn an entry. Churning 4096 identities therefore flushes every existing ban, including long (24 h) bans on peers that were isolated for a reason.\n\nVerified against the shipped store: a 24 h ban on one peer → `IsBanned=true`; after 4 200 throwaway bans → `live=4096, evictions=105`, `IsBanned(real offender)=false`. The persisted `bans.json` snapshot also keeps only 4096 entries, so the eviction survives restart.\n\n## Impact\n\n`network_id` / `sys.min_protocol_version` isolation becomes best-effort: a peer that was banned for speaking the wrong network or an old protocol can return after identity churn. Cost is roughly one connection plus one netcheck answer per ban (global limiter 32 RPS ≈ two minutes for the full flush).\n\n## Fix\n\nKeep a separate, non-evictable set for security bans (wrong network id / protocol version) with a longer TTL, or evict by a policy that prefers short-lived / low-severity entries and never removes a ban younger than some floor. Cap per-IP/ASN ban creation so a single actor cannot fill the table.\n","patch_refs":[{"id":208,"repo":"xeprotocol/xe","kind":"pr","ref":"208","title":"fix(net/banstore): protect security bans and retention floor against throwaway identity eviction (fixes #202)","url":"https://github.com/xeprotocol/xe/pull/208","note":"","state":"open","author":"NePreby","added_by":"desk","created_at":"2026-10-29T17:43:03.496410+00:00"},{"id":237,"repo":"xeprotocol/xe","kind":"pr","ref":"238","title":"fix(net/banstore): protect security bans and retention floor against throwaway identity eviction (fixes #202)","url":"https://github.com/xeprotocol/xe/pull/238","note":"","state":"open","author":"tipprb","added_by":"desk","created_at":"2026-11-02T00:00:13.584376+00:00"}],"thread":[{"id":1597,"source":"desk","source_ref":"reply:716","author":"Joseph Denne","team":true,"body":"Thanks for the report. We have confirmed the ban-table behaviour you describe and it is being handled; we will update this ticket when the fix is in.","created_at":"2026-11-08T20:17:41.885067+00:00"}]}