[Medium] Unbounded oracle R + TWAP=0 disables the lease payout cap (unbounded mint via oracle epoch)
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):
- No upper bound on
RVolume/RPriceFloor/REffective. The checks only relate the three R values to each other, never to any sane range. Tokenomics definesRInit = 2000andRFloor = 100, but they are not enforced here. RCollusion = 0andTWAP = 0are treated as "feature disabled", not invalid:expectedRCollusionreturns 0 when TWAP is 0, theRCollusion != 0consistency checks are skipped, andcore.CapR(core/ledger.go:2037) returnsRuncapped whentwap == 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—validateEpochValueacceptsR=1e9, TWAP=0, RCollusion=0, RSource="volume"; same withTWAP=250, RCollusion=0; and a fullChain.AddBlockaccepts the maliciousepoch.1block 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 viaLeaseTotalEmission.
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, rejectTWAP == 0and rejectRCollusion == 0(or require it to be >= the supportive R), and boundREffective(and its components) to a sane maximum, e.g.R <= 100_000milli (100x) or a tokenomics-derived ceiling. - Make
CapRfail closed instead of returning uncappedRwhen 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 testas above, no testnet nodes involved (local reproduction only)
Thread
XE payout address: e3d3e4407fec5a846201c7ed8560484ffb881cc30068745a110dd8efb824500c
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.