{"id":"XE-0446","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"254","source_url":"https://github.com/xeprotocol/xe/issues/254","reporter_id":190,"title":"[High] net: unauthenticated wrong-chain admission (netcheck genesis_hash omission) + dirty-flag poisoning force perpetual full-mesh resync — composes with #44 and #202 into an unmitigable DoS","area":null,"claimed_tier":"high","assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"closed","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-04T09:26:12.650472+00:00","updated_at":"2026-11-10T00:11:30.930482+00:00","source_created_at":"2026-11-04T09:24:30+00:00","told_at":"2026-11-05T22:07:31+00:00","status_changed_at":"2026-11-05T22:07:15.431518+00:00","url":"https://bounty.xe.network/XE-0446","body":"**Suggested severity: High** (unauthenticated, remote, persistent; composes with #44 and #202 into an unmitigable DoS — see Composition)\n\n**Duplicate check:** swept the full live tracker (`gh issue list --state all`). The two defects claimed here are not reported: no issue covers the `netcheck` genesis-hash omission, and none covers inbound sync requests poisoning the sync tracker's dirty flag. Related, already-tracked stages are referenced below and explicitly **not** re-claimed.\n\nReviewed at commit `02e9641b0ac64437f57e09d63301f88cce61a802` (2026-11-03).\n\n## Defect 1 — netcheck genesis check is opt-in for the remote peer → wrong-chain peers admitted\n`net/netcheck.go:366`:\n```go\nif ours.GenesisHash != \"\" && msg.GenesisHash != \"\" && msg.GenesisHash != ours.GenesisHash {\n    return fmt.Sprintf(\"statechain genesis mismatch ...\"), defaultBanDur\n}\n```\nA peer on a different chain (different genesis) with the same `network_id` simply omits `genesis_hash` and passes every check. It stays connected, can sync, gossip, and drive Defect 2 below.\n\nObserved (PoC against a copy of the repo, original untouched):\n```\nwrong-genesis peer with genesis_hash omitted -> reason=\"\" ban=0s\nCONFIRMED: admitted\n```\n\n## Defect 2 — one unauthenticated inbound sync request poisons the dirty flag → perpetual full-mesh resync\n`net/sync.go:459-475` (`handleSyncStream`) + `:478-508` (`frontiersWhereServerIsBehind`):\n```go\nbehind := frontiersWhereServerIsBehind(req.Frontiers, ledger)\n...\nif tracker != nil && len(behind) > 0 { tracker.MarkDirty() }\n```\n`frontiersWhereServerIsBehind` marks the server \"behind\" for any account it holds whose remote frontier is a 64-hex string that is neither our frontier nor in our chain. Accounts are publicly enumerable (`GET /accounts`, `GET /frontiers`, gossip). `MarkDirty()` then makes the periodic loop (`:345-384`) sync with **every** connected peer every 10 s — re-armed each 5 s by the next request, because the inbound limiter is per-peer-ID and identities are free.\n\nObserved:\n```\nCONFIRMED: single unauthenticated inbound sync request set the dirty flag\n```\nTrigger cost: ~270 bytes, no authentication beyond a completed libp2p handshake.\n\n## Composition — why this is filed as High\nNeither defect alone is a crash. Composed with two already-tracked defects they form an attack with **no mitigation path**:\n- **#201** (DHT discovery DoS) and the unauthenticated `xe/discovery/1/<networkID>` rendezvous namespace (`net/discovery.go:94-135`, `round()` dials every returned record with no admission check) let the attacker fill the victim's peer set with its own nodes;\n- **Defect 1** keeps those nodes admitted even when they are on the wrong chain;\n- **Defect 2** converts each of them into a perpetual resync trigger;\n- **#44** (already tracked) is the memory-exhaustion stage those resyncs feed;\n- **#202** (already tracked) is why the victim cannot ban the attackers: 4096 throwaway identities evict legitimate bans FIFO in ~2 minutes.\n\nThe node's answer to a malicious peer — banning — is defeated by #202, and the reconnaissance step is free via the public read endpoints. What is new in this report is the admission bypass (Defect 1), the 270-byte trigger (Defect 2), and the composition argument.\n\n**Fix direction:** (1) require `genesis_hash` when the local node has one — reject peers that omit it; (2) require proof-of-work or a pre-existing authenticated connection for inbound sync requests, and rate-limit `MarkDirty` per peer; (3) treat the dirty flag as a hint, not a command, when set by an unauthenticated remote.\n","patch_refs":[{"id":273,"repo":"xeprotocol/xe","kind":"pr","ref":"265","title":"fix(net): require genesis_hash in netcheck and gate inbound sync dirty-flag triggers (fixes #254)","url":"https://github.com/xeprotocol/xe/pull/265","note":"","state":"open","author":"tipprb","added_by":"desk","created_at":"2026-11-04T10:52:17.338560+00:00"}],"thread":[{"id":386,"source":"github","source_ref":"6670796882","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0232, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, reply with what differs and we will look again.","created_at":"2026-11-05T22:07:31+00:00"}]}