Bounty
XE-13363 · Bounty

[Medium] Unbounded oracle R + TWAP=0 disables the lease payout cap (unbounded mint via oracle epoch)

Closed · duplicate —claimed Medium xe#372 filed 2026-11-11 11:12 UTC by akitaBugBounty

Report

Summary

The statechain oracle epoch validator (validateEpochValue in statechain/kvstore.go) puts no upper bound on the emission multiplier R, and treats TWAP = 0 / RCollusion = 0 as "feature disabled" instead of invalid. The ledger-side payout cap (CapR in core/ledger.go) also returns R uncapped whenever twap == 0. The production genesis configures sys.oracle as a single key with threshold 1, so a compromised, insider, or misconfigured oracle can publish an epoch with an arbitrarily large R and the cap switched off — and any lease settling against that epoch mints cost * R / 1000 with no effective limit.

Impact

A 1-of-1 oracle epoch with R = 1,000,000,000 (1,000,000x the intended ~1–2x range) and TWAP = 0 passes validation and is accepted by the statechain end-to-end. A $31 lease (cost 31,000 mXUSD) settles for 31,000 XE; a legitimate epoch (R ~2,000) would pay ~0.000062 XE. Emission is bounded only by uint64 overflow in safeMul, i.e. effectively unbounded for realistic leases.

Severity is Medium, not Critical: exploitation requires the trusted oracle key, so this is a single-point-of-failure / missing-validation issue, not a remotely exploitable bug. But the on-chain impact of a compromised or misconfigured oracle is unbounded mint.

Root cause (repo github.com/xeprotocol/xe, commit 89a542ea51d38375299aee54c6c99102e9bfa666, "release: testnet-0005 quorum withhold fix")

Two gaps in statechain/kvstore.go validateEpochValue (~line 333):

  1. No upper bound on RVolume / RPriceFloor / REffective. The checks only relate the three R values to each other, never to any sane range. Tokenomics defines RInit = 2000 and RFloor = 100, but they are not enforced here.
  2. RCollusion = 0 and TWAP = 0 are treated as "feature disabled", not invalid: expectedRCollusion returns 0 when TWAP is 0, the RCollusion != 0 consistency checks are skipped, and core.CapR (core/ledger.go:2037) returns R uncapped when twap == 0:
func CapR(r, payoutCap, twapMilliUSD uint64) uint64 {
	if payoutCap == 0 || twapMilliUSD == 0 {
		return r
	}
	...
}

Trust context: production genesis sets sys.oracle to a single key (ad674f8c1683db33f9c2b97daf91733123015e9c8b6e496f0301a9a78165f864), threshold 1 (statechain/genesis.json). DAO is 2-of-3 and timekeepers 2-of-3, but the oracle is 1-of-1.

Reproduction

PoC tests (assert the vulnerable behaviour; they fail once fixed):

  • statechain/xe01_poc_test.go — validateEpochValue accepts R=1e9, TWAP=0, RCollusion=0, RSource="volume"; same with TWAP=250, RCollusion=0; and a full Chain.AddBlock accepts the malicious epoch.1 block end-to-end (2-of-2 DAO genesis + 1-of-1 oracle).
  • core/xe01_poc_test.go — CapR(1e9, 1502, 0) == 1e9; LeaseEmissionChecked(31000, 1e9) == 31,000,000,000 mXE = 31,000 XE; same via LeaseTotalEmission.

Run:

git clone https://github.com/xeprotocol/xe && cd xe
# add the two PoC test files above, then:
go test ./statechain/ -run XE01 -v   # 3/3 PASS (vulnerable behaviour reproduced)
go test ./core/ -run XE01 -v         # 3/3 PASS

Malicious epoch used by the PoC (epoch.1, JSON):

{"epoch":1,"start_ns":0,"end_ns":1000000000,"twap_milli_usd":0,
 "r_volume":1000000000,"r_price_floor":100,"r_collusion":0,
 "r_effective":1000000000,"r_source":"volume","phase":1,"payout_cap":1502}

Suggested fix

  • In validateEpochValue, reject TWAP == 0 and reject RCollusion == 0 (or require it to be >= the supportive R), and bound REffective (and its components) to a sane maximum, e.g. R <= 100_000 milli (100x) or a tokenomics-derived ceiling.
  • Make CapR fail closed instead of returning uncapped R when TWAP is 0.
  • Consider raising the oracle threshold above 1.

Environment

  • Codebase: github.com/xeprotocol/xe @ 89a542e (2026-11-10)
  • Go 1.25.0, go test as above, no testnet nodes involved (local reproduction only)

Thread

akitaBugBounty2026-11-11 11:22 UTCgithub

XE payout address: e3d3e4407fec5a846201c7ed8560484ffb881cc30068745a110dd8efb824500c

Joseph Denneteam2026-11-20 00:05 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-13363 and says what differs; it is read like any other.