Bounty
XE-1249 · Bounty

Peer capability table evicts legitimate representatives under throwaway-identity flood, blinding DAO activation readiness

Closed · duplicate Medium xe#301 filed 2026-11-08 01:42 UTC by rusdiwireng

Report

Summary

GET /network/readiness is the gate the DAO reads before signing an activation. It builds its numbers from the peer capability table, which maps each libp2p peer ID to the version and features that peer advertised during the netcheck handshake. That table holds at most 4096 entries and evicts the oldest entry when it fills up. A single machine can fill it with throwaway peer IDs in about two minutes, because a netcheck handshake needs nothing the attacker does not already have: the network ID and genesis hash are public, and any compatible version string passes. Once the table is full of throwaway entries, every legitimate representative's capabilities are gone from it, GetReadiness counts their weight as unknown, and the readiness endpoint reports low numbers for features the network actually supports. The DAO then holds off on signing the activation. Nothing gets activated wrongly. Activation just stalls.

Affected code

  • net/features.go:12, maxPeerCapEntries = 4096
  • net/features.go:37-49, (*peerCapTable).record, FIFO eviction
  • net/netcheck.go:415 and net/netcheck.go:471, RecordPeerCapabilities on inbound and outbound handshakes
  • net/netcheck.go:329, handshake rate limit, 32 per second global, burst 128
  • node/activations.go:155-180, GetReadiness, reps without recorded capabilities fall into UnknownWeight
  • api/handler.go:151, GET /network/readiness
  • docs/activations.md:166, activation needs readiness at or above 90% for 7 consecutive days

Root cause

record appends each new peer ID to an order list and, while the list is longer than 4096, drops the oldest ID from both the list and the map:

t.caps[p] = c
for len(t.order) > maxPeerCapEntries {
    oldest := t.order[0]
    t.order = t.order[1:]
    delete(t.caps, oldest)
}

Three properties around it turn this into an eviction primitive:

  1. Nothing removes a peer from the table when it disconnects, and nothing re-verifies a connected peer on a schedule. verifyPeer runs only when a new connection arrives (net/netcheck.go:342). A legitimate peer that stays connected is never re-recorded, so once it is evicted it stays evicted until it reconnects.
  2. Recording a peer needs no authentication beyond the handshake itself. checkPeer verifies network ID, genesis hash, and a compatible semver version, all of which are public or trivially chosen. The attacker does not need stake, delegation, or any account on the network.
  3. The rate limit does not stop a flood of new identities. Each new peer ID gets a fresh per-peer bucket with burst 3, and the global limit is 32 handshakes per second with burst 128. At that rate 4096 handshakes take about two minutes. The cap of 256 simultaneous inbound connections (net/netcheck.go:40) does not apply either, because the attacker can connect, handshake, and disconnect in sequence instead of holding connections open.

GetReadiness looks up each representative through the directory (ListDirectory) and then through the table (AllPeerCapabilities). A representative whose peer ID is no longer in the table is skipped, its weight goes to UnknownWeight, and its features contribute nothing to FeatureWeight. The readiness endpoint then shows the network as unready.

Measured evidence

Tested locally against the real peerCapTable code with a temporary Go test in package net (written, run, then deleted; the repository is untouched):

  • Record one legitimate peer with feature messaging.
  • Record 4096 throwaway peer IDs.
  • The legitimate peer is gone from the table. Table size is exactly 4096.
  • Record the legitimate peer again and it is visible again.

Output:

=== RUN   TestZZCapsEvictProbe
    PROBE CONFIRMED: 4096 throwaway peer IDs evict a legit peer's
    capabilities from the 4096-entry FIFO; re-record restores it
--- PASS: TestZZCapsEvictProbe (0.02s)

The step from an evicted table to a wrong readiness number follows from the code in GetReadiness (node/activations.go:155-180): a representative with no entry in the capabilities map is counted in UnknownWeight and contributes no feature weight. That part was checked by reading the code, not by running a live node.

Impact

The readiness numbers the DAO relies on go wrong in the under-reporting direction. A representative that has upgraded and advertises a feature is counted as unknown, so the feature looks less ready than it is. The DAO procedure asks for readiness at or above 90% for 7 consecutive days before signing (docs/activations.md:166), so even a short dip can restart that 7 day wait. The effect ends when legitimate peers reconnect and their capabilities are recorded again, which means an attacker who wants to hold the eviction has to keep handshaking at roughly 32 per second. The failure stays on the side of caution: activation is delayed, never wrongly granted, and no funds move.

Related findings

This is a different defect from #287, which is about the contents of the table: duplicate feature strings from one peer inflating its weight. That issue says nothing about the size of the table or about eviction, and its use of the word "capping" refers to the 8 feature limit per peer. This report is about the table itself: new identities pushing old entries out.

The shape is similar to #202, where the ban store FIFO of 4096 entries can be flushed with throwaway identities. The store here is different and so is the result: instead of a ban being evaded, the readiness gate goes blind. #201 and #47 cover Sybil-style pressure on neighbouring pieces (peer counting and per-peer rate limiting) with different mechanisms.

Suggested fix

Any one of these closes the hole:

  • Keep capability entries for peers the node is currently connected to, and evict disconnected peers first.
  • Re-verify capabilities for connected peers on a schedule, so an evicted legitimate peer comes back without waiting for a reconnect.
  • Reserve part of the table for peers that appear in the directory or hold delegated weight, and let throwaway identities compete only for the rest.

Method limits

  • The eviction itself was reproduced in process against the real table code. The wrong readiness number was traced through the GetReadiness code, not measured on a running node. No live node was driven and no testnet traffic was sent.
  • The two minute estimate for 4096 handshakes follows from the configured global limit of 32 per second with burst 128. It was not measured against a live node.
  • The 7 day soak comes from the written DAO procedure in docs/activations.md:166. Whether the DAO measures the streak from this endpoint continuously is a matter of their procedure, not of this code.

Thread

rusdiwireng2026-11-08 03:46 UTCgithub

Thanks for the fix in PR #302 — I reviewed it locally against the PR code (commit 015ccbf), and it closes the core of this issue for an ordinary throwaway flood (connected, trusted, and directory-listed peers are now retained). Five legs are still open:

  1. No periodic re-verification. verifyPeer still runs only when a new connection arrives. A legitimate representative evicted while connected does not come back until it reconnects.

  2. Handshake without authentication. checkPeer is unchanged: it still verifies only network ID, genesis hash, and a compatible semver version.

  3. Rate limit unchanged. netcheckGlobalRPS is still 32 per second with burst 128, so the flood rate is the same as before.

  4. No removal on disconnect. There is no hook that deletes a peer's capabilities when it disconnects. PR #302 replaces removal with eviction preference (a disconnected peer is evicted first), so stale entries still occupy the table until eviction pressure arrives.

  5. The third suggested fix in this issue (reserve part of the table for directory peers or peers holding delegated weight) is only partly implemented. Retention through the directory has no quota on retained non-connected entries and no delegated-weight check at all. That gap is the root cause of the follow-up finding I filed separately as #304, where a throwaway identity registers itself in the directory for free and claims retain protection.

XE deskteam2026-11-14 22:50 UTCgithub

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, file a new report that links https://bounty.xe.network/XE-1249 and says what differs; it is read like any other.