Undeduplicated netcheck features and uint64 overflow in GetReadiness let a 1% representative forge >=90% DAO activation readiness
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}$:
-
Unvalidated and undeduplicated
netcheckMsg.Featuresamplifies 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 outgoingLocalFeatures()(net/features.go:68-74) and is never enforced on inboundnetcheckMsg.FeaturesincheckPeer,handleNetcheckInbound,verifyPeer, orRecordPeerCapabilities. Nor are incoming feature strings validated againstfeatureNameRegex(^[a-z][a-z0-9_]{0,31}$) or deduplicated.- In
(*Node).GetReadiness(node/activations.go:185-187), the loop:
adds the representative's full delegated weightfor _, f := range c.Features { info.FeatureWeight[f] += w }wonce per element inc.Featureswithout deduplication. - Within the 1,024-byte
maxNetcheckByteshandshake frame (net/netcheck.go:34), a peer can repeat a feature name ~95–130 times inFeatures. A representative holding just 1% of delegated weight (w = 100,TotalWeight = 10,000) repeating"messaging"95 times inflatesFeatureWeight["messaging"]from100to9,500andFeatureReadyMilli["messaging"]from10(1.0%) to950(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.
-
uint64multiplication overflow inw * 1000 / info.TotalWeight(node/activations.go:196):- Delegated weights are denominated in micro-XE (
10^-6XE) asuint64values (core/ledger.go:2680-2687). - At
node/activations.go:196,info.FeatureReadyMilli[f] = w * 1000 / info.TotalWeightevaluatesw * 1000in 64-bit unsigned arithmetic before dividing byinfo.TotalWeight. - Whenever
w > math.MaxUint64 / 1000(18,446,744,073,709,551micro-XE, or at a fraction of that when amplified by duplicate feature entries),w * 1000overflowsuint64and wraps modulo $2^{64}$. For example, atw = TotalWeight = 20_000_000_000_000_000micro-XE (100% actual readiness),FeatureReadyMillireports77(7.7%) instead of1000(100.0%).
- Delegated weights are denominated in micro-XE (
Root Cause
net/netcheck.go:354-389(checkPeer): checksNetworkID,GenesisHash, andVersion, but performs zero validation onmsg.Features(nomaxAdvertisedFeaturesbound, noValidateFeatureNamecheck, and no duplicate check).net/features.go:37-49((*peerCapTable).record): storesc.Featuresverbatim without sanitizing, deduplicating, or capping atmaxAdvertisedFeatures.node/activations.go:185-197((*Node).GetReadiness):
iterates overfor _, f := range c.Features { info.FeatureWeight[f] += w } ... info.FeatureReadyMilli[f] = w * 1000 / info.TotalWeightc.Featureswithout per-representative deduplication, uses unchecked+=instead of saturating addition (addSat), and computesw * 1000 / info.TotalWeightusing 64-bit multiplication that overflows forw > math.MaxUint64 / 1000.
Reproduction
Run the in-process regression tests against unpatched HEAD (02e9641):
Thread
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.