<!-- XE-1081 · Undeduplicated netcheck features and uint64 overflow in GetReadiness let a 1% representative forge ›=90% DAO activation readiness · testnet -->
*Markdown view of <https://bounty.xe.network/XE-1081>. The page is the record; this is the same page for reading.*

XE-1081 · Bounty

# Undeduplicated netcheck features and uint64 overflow in GetReadiness let a 1% representative forge \>\=90% DAO activation readiness

Closed · duplicate
—claimed High
[xe#287](https://github.com/xeprotocol/xe/issues/287)
filed 2026-11-07 14:13 UTC
by pa-khan

Verdict
:   Duplicate

Tier
:   —

Claimed
:   High

Area
:   P2P / sync

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-14 22:55 UTC

Told
:   2026-11-14 22:53 UTC

### Patches

- [xe#288](https://github.com/xeprotocol/xe/pull/288) open by pa-khan
  net, node, statechain: deduplicate and validate advertised features and prevent uint64 overflow in GetReadiness
- [xe#294](https://github.com/xeprotocol/xe/pull/294) open by tipprb
  net, node, statechain: deduplicate and validate advertised features and prevent uint64 overflow in GetReadiness

### History

- [209972](https://bounty.xe.network/log/209972) 2026-11-14 22:53 UTC reply.mirrored
- [209923](https://bounty.xe.network/log/209923) 2026-11-14 22:53 UTC reply.sent
- [45029](https://bounty.xe.network/log/45029) 2026-11-08 20:33 UTC github.state\_pushed
- [45028](https://bounty.xe.network/log/45028) 2026-11-08 20:33 UTC github.labels
- [44674](https://bounty.xe.network/log/44674) 2026-11-08 20:32 UTC proposal.adopted
- [44673](https://bounty.xe.network/log/44673) 2026-11-08 20:32 UTC ticket.status new → closed
- [31193](https://bounty.xe.network/log/31193) 2026-11-08 11:43 UTC proposal.adopted
- [31192](https://bounty.xe.network/log/31192) 2026-11-08 11:43 UTC ticket.facts area
- [31191](https://bounty.xe.network/log/31191) 2026-11-08 11:43 UTC proposal.adopted
- [31190](https://bounty.xe.network/log/31190) 2026-11-08 11:43 UTC ticket.facts
- [31189](https://bounty.xe.network/log/31189) 2026-11-08 11:43 UTC proposal.adopted
- [31188](https://bounty.xe.network/log/31188) 2026-11-08 11:43 UTC ticket.facts

[Full history](https://bounty.xe.network/log?ref=XE-1081) · [JSON](https://bounty.xe.network/v1/tickets/XE-1081) · [markdown](https://bounty.xe.network/XE-1081.md)

### Report

Suggested severity tier: High

Area: `node/activations.go`, `net/netcheck.go`, `net/features.go`, `node/node.go`

Repository state checked: `xeprotocol/xe` HEAD `02e9641`

## Summary

`GET /network/readiness` (`(*Node).GetReadiness` in `node/activations.go:151-208`) is the delegated-weight readiness gate that the DAO checks before signing a `sys.activations` transaction (`docs/activations.md:126-166`, `api/handler.go:151`). Two bugs in how advertised peer features are ingested and aggregated allow any minor representative with non-zero delegated weight to forge arbitrary `feature_weight` and `feature_ready_milli` values, and cause large micro-XE weights to silently wrap around modulo $2^{64}$:

1. **Unvalidated and undeduplicated `netcheckMsg.Features` amplifies a single representative's weight $K\\times$ (`net/netcheck.go:354-389, 415, 471`, `net/features.go:37-49`, `node/activations.go:185-187`)**:

   - `maxAdvertisedFeatures = 8` (`net/netcheck.go:36`) is only applied to outgoing `LocalFeatures()` (`net/features.go:68-74`) and is never enforced on inbound `netcheckMsg.Features` in `checkPeer`, `handleNetcheckInbound`, `verifyPeer`, or `RecordPeerCapabilities`. Nor are incoming feature strings validated against `featureNameRegex` (`^[a-z][a-z0-9_]{0,31}$`) or deduplicated.
   - In `(*Node).GetReadiness` (`node/activations.go:185-187`), the loop:

     ```
     for _, f := range c.Features {
         info.FeatureWeight[f] += w
     }
     ```

     adds the representative's full delegated weight `w` once per element in `c.Features` without deduplication.
   - Within the 1,024-byte `maxNetcheckBytes` handshake frame (`net/netcheck.go:34`), a peer can repeat a feature name \~95–130 times in `Features`. A representative holding just **1% of delegated weight** (`w = 100`, `TotalWeight = 10,000`) repeating `"messaging"` 95 times inflates `FeatureWeight["messaging"]` from `100` to `9,500` and `FeatureReadyMilli["messaging"]` from `10` (1.0%) to **`950` (95.0%)**, crossing both the 67% finality quorum (`670`) and the 90% (`900`) DAO activation gate (`docs/activations.md:145-166`) while 99% of representative weight does not support the feature.
2. **`uint64` multiplication overflow in `w * 1000 / info.TotalWeight` (`node/activations.go:196`)**:

   - Delegated weights are denominated in micro-XE (`10^-6` XE) as `uint64` values (`core/ledger.go:2680-2687`).
   - At `node/activations.go:196`, `info.FeatureReadyMilli[f] = w * 1000 / info.TotalWeight` evaluates `w * 1000` in 64-bit unsigned arithmetic before dividing by `info.TotalWeight`.
   - Whenever `w > math.MaxUint64 / 1000` (`18,446,744,073,709,551` micro-XE, or at a fraction of that when amplified by duplicate feature entries), `w * 1000` overflows `uint64` and wraps modulo $2^{64}$. For example, at `w = TotalWeight = 20_000_000_000_000_000` micro-XE (100% actual readiness), `FeatureReadyMilli` reports **`77` (7.7%)** instead of **`1000` (100.0%)**.

## Root Cause

- `net/netcheck.go:354-389` (`checkPeer`): checks `NetworkID`, `GenesisHash`, and `Version`, but performs zero validation on `msg.Features` (no `maxAdvertisedFeatures` bound, no `ValidateFeatureName` check, and no duplicate check).
- `net/features.go:37-49` (`(*peerCapTable).record`): stores `c.Features` verbatim without sanitizing, deduplicating, or capping at `maxAdvertisedFeatures`.
- `node/activations.go:185-197` (`(*Node).GetReadiness`):

  ```
  for _, f := range c.Features {
      info.FeatureWeight[f] += w
  }
  ...
  info.FeatureReadyMilli[f] = w * 1000 / info.TotalWeight
  ```

  iterates over `c.Features` without per-representative deduplication, uses unchecked `+=` instead of saturating addition (`addSat`), and computes `w * 1000 / info.TotalWeight` using 64-bit multiplication that overflows for `w > math.MaxUint64 / 1000`.

## Reproduction

Run the in-process regression tests against unpatched `HEAD` (`02e9641`):

### Thread

**XE desk**team2026-11-14 22:53 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-1081 and says what differs; it is read like any other.
