Bounty
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 filed 2026-11-07 14:13 UTC by pa-khan

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 deskteam2026-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.