{"id":"XE-0098","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"167","source_url":"https://github.com/xeprotocol/xe/issues/167","reporter_id":32,"title":"Sync quarantine poisoning suppresses genuine blocks","area":"p2p-sync","claimed_tier":"medium","assessed_tier":null,"verdict":null,"duplicate_of":null,"tracked":true,"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-29T13:57:26.691585+00:00","updated_at":"2026-11-14T22:56:50.689053+00:00","source_created_at":"2026-10-29T04:34:42+00:00","told_at":"2026-11-08T20:19:05+00:00","status_changed_at":"2026-11-08T20:17:53.632802+00:00","url":"https://bounty.xe.network/XE-0098","body":"# Sync quarantine poisoning suppresses genuine blocks\n\n## Summary\n\nA bad-signature copy of a real block, served before the victim syncs the\ngenuine block, gets its hash quarantined — and because block hashes do not\ncover the signature, every later genuine copy of that block (identical\nhash, valid signature) is dropped by the sync filter before\n`AddSyncedBlock` is ever called, from any peer. The victim's sync of that\nblock stalls until the quarantine entry is FIFO-evicted or the node\nrestarts.\n\n## Impact\n\nSync-path suppression / chain-sync stall for the victim node. Worst for\nhistorical blocks, which are never re-gossiped: once the genuine copy is\nfiltered, nothing on the sync path retries it. This is suppression only,\nnot integrity — genuine blocks are never altered, only skipped on one\npath. The gossip path does not consult the quarantine at all, so the\nsuppression is sync-path-only.\n\nSuggested program tier: **Medium**.\n\n## Root cause\n\n- `net/sync.go:589-597`: the sync filter skips any block whose hash is in\n  the quarantine set, and the set is global, not per-peer — the single\n  quarantine object is created once in `SetupSync` (`sync.go:307`) and\n  passed to every `requestSync` call. A poison entry from one peer\n  therefore blocks the genuine block from every peer.\n- `net/sync.go:602-620`: a non-retryable rejection adds the block hash to\n  the quarantine (`quarantine.add(b.Hash)` at `:613`).\n- `core/crypto.go:85-98`: `HashBlock` hashes `MarshalBlockCanonical` plus\n  `MarshalBlockAux` only. A field scan of `MarshalBlockCanonical`\n  (`core/encoding.go:43-297`) confirms it never writes `Signature` or\n  `Signatures`, so a bad-signature copy and the genuine block share one\n  hash.\n- `core/retryable.go`: the retryable-error pattern list contains no\n  `\"signature\"` entry, so signature failures are non-retryable and land\n  in the quarantine. Observed forms: `\"signature: signature verification\n  failed\"` (non-open path) and `\"verify: signature verification failed\"`\n  (open-block path) — both non-retryable.\n- Quarantine size and lifetime, read from the code: `maxQuarantineEntries\n  = 8192` (`sync.go:245`), an in-memory map plus FIFO order list with\n  eviction of the oldest entry (`add`, `:258-275`), no persistence. So\n  the stall lasts until 8192 later quarantine additions FIFO-evict the\n  entry, or the node restarts.\n\n## Proof of concept\n\nTarget: `xeprotocol/xe` @ `978785929bc17a2f4ab30c383e5fc9cf4d634512`\n(2026-10-15). Two harnesses, both against the real `net`/`core` packages\nwith real loopback libp2p hosts, a real ledger, and real `requestSync`;\nthe repository itself is not modified.\n\nAttached PoCs: `pocs/poc-slice6-test.go.txt` (original harness) and\n`pocs/reval-f05-test.go.txt` (re-validation harness with the instrumented\nskip observation), both byte-identical copies of the runnable sources.\n\nRun (Go 1.25.14):\n\n```\nexport PATH=\"$HOME/.local/go/bin:$PATH\"\nGOPROXY=off go test -vet=off ./net/ -run 'TestSlice6QuarantinePoison' -v -count=1 -timeout 300s\n```\n\nObserved output (verbatim, re-validation run 2026-10-29):\n\n```\n=== RUN   TestSlice6QuarantinePoison\n    poc_slice6_test.go:108: AddSyncedBlock(bad-sig) error: signature: signature verification failed\n    poc_slice6_test.go:112: rejection is NON-retryable => requestSync quarantines by hash\n    poc_slice6_test.go:123: hash identical across different Signature values: 8e2f6ea9efc393baa95ee9fd811a958507e915c61f7c6ff559233a175055a79b\n    poc_slice6_test.go:130: quarantine.contains(genuine-content hash) == true => later genuine copy skipped by sync filter\ntime=2026-10-29T03:43:54.420Z level=WARN msg=\"sync: block 8e2f6ea9efc3... rejected (quarantined): signature: signature verification failed\"\n    poc_slice6_test.go:148: requestSync quarantined bad-sig block hash: 8e2f6ea9efc393baa95ee9fd811a958507e915c61f7c6ff559233a175055a79b\nPOISON-MECHANISM-OK\n--- PASS: TestSlice6QuarantinePoison (0.44s)\n```\n\n### Terminal skip, directly observed (re-validation 2026-10-29)\n\nThe original report stated the terminal genuine-skip as inferred from\nexecuted preconditions plus the deterministic filter, because the skip\nbranch is never logged. On re-validation the skip was observed directly:\nin a scratch copy of the repository only, one log line was added after\n`skipped++` in the filter, and the full scenario was run — phase 1\npoisons from peer 1, phase 2 serves the genuine-content copy from peer\n2. Verbatim log lines:\n\n```\ntime=... level=WARN msg=\"sync: block 7cb8c5379b84... rejected (quarantined): signature: signature verification failed\"\ntime=... level=WARN msg=\"REVAL-F05-SKIP: sync filter dropped quarantined block 7cb8c5379b8447cae90314c8f5d87b1344e89a9e8c3cad3811c08de42393ec5e\"\n```\n\nA second scenario used a credential-valid genuine copy (fresh keypair,\nreal `core.SignBlock`, account derived from the pubkey); its control\n`AddSyncedBlock` failed only on state, proving hash, pubkey derivation,\nand signature all passed — and it was still dropped by the filter:\n\n```\ntime=... level=WARN msg=\"sync: block 6c27c476432c... rejected (quarantined): verify: signature verification failed\"\ntime=... level=WARN msg=\"REVAL-F05-SKIP: sync filter dropped quarantined block 6c27c476432ce669879b46f1469321b09a8739219f3f98ca6ec9424685900db8\"\n```\n\nCounts across the run: exactly 2 skip lines (one per phase 2) and exactly\n2 quarantine-rejection warnings (both phase 1, zero in phase 2) —\nproving `AddSyncedBlock` was never reached for either phase-2 copy, and\nthat the skip is peer-independent in execution, not just in code\nstructure.\n\n## Reproduction steps\n\n1. Attacker serves a same-content, garbage-signature copy of a real block\n   to a syncing victim.\n2. Victim rejects it (non-retryable) → the block hash is quarantined.\n3. Victim later syncs the genuine block from any peer → the sync filter\n   drops it by hash before `AddSyncedBlock` is called.\n\n## Recommended fix\n\nQuarantine per-peer instead of globally, and/or include the signature in\nthe quarantine key, and/or make signature failures retryable for sync\npurposes.\n\n## Severity\n\n- CVSS 3.1: 5.3 — `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`\n- CWE-840 (Business Logic Errors)\n\n## Caveats\n\n- The instrumented skip observation used a 1-line added log statement in\n  a scratch copy of the repository; the filter logic itself was not\n  modified, and the original repository is untouched. The production\n  filter remains unlogged, so in an unmodified node the skip is silent.\n- The credential-valid genuine copy in scenario B is not state-applicable\n  (a send cannot open an account) — it is the strongest genuine copy\n  constructible without the genesis private key, and it is sufficient\n  here because the filter reads only `b.Hash` and never inspects\n  signatures.\n- No public prior report of the sync-quarantine poisoning mechanism was\n  found (dedup queries recorded in the audit's DEDUP-BASELINE.md).\n- This reproduction runs against the repository code at the stated HEAD. No\n  testnet transactions were sent as part of this report.\n\nPayout address (XE): eff2c51dd8457df740b919226cd9b37a2944e5abea7501094db80234f87f010e\n\nBest,\nChaplin\n\n[poc-slice6-test.go.txt](https://github.com/user-attachments/files/34112436/poc-slice6-test.go.txt)\n[reval-f05-test.go.txt](https://github.com/user-attachments/files/34112437/reval-f05-test.go.txt)","patch_refs":[{"id":184,"repo":"xeprotocol/xe","kind":"pr","ref":"189","title":"fix(net): bind sync quarantine keys to block signatures to prevent poisoning (fixes #167)","url":"https://github.com/xeprotocol/xe/pull/189","note":"","state":"open","author":"arturbarszcz78","added_by":"desk","created_at":"2026-10-29T13:57:30.091343+00:00"}],"thread":[{"id":1171,"source":"github","source_ref":"6726599002","author":"Joseph Denne","team":true,"body":"Thanks for the detailed report. We have confirmed the behaviour and it is being handled; we will update this ticket when there is more to share.","created_at":"2026-11-08T20:19:05+00:00"}]}