Lease Allocation Failure & Rejection: pickProvider hardcodes stake to 1 selecting undercapitalized providers rejected by consensus
Report
Vulnerability Summary
In cmd/xe/main.go:1024-1045 and 1719-1743, cmdLease automatically selects a provider for consumer leases when --provider is not explicitly supplied:
if providerAddr == "" {
providerAddr = pickProvider(c, vcpus, memory, disk, 1)
}
...
cost, err := core.LeaseCost(vcpus, memory, disk, duration, certMult)
if err != nil {
fatal("cost calculation: %v", err)
}
stake := core.LeaseStake(cost)
In pickProvider:
func pickProvider(c *client.Client, vcpus, memoryMB, diskGB, stake uint64) string {
...
for i := range providers {
p := &providers[i]
if !providerFits(p, vcpus, memoryMB, diskGB) {
continue
}
bals, _ := c.GetBalances(p.Account)
if bals["XUSD"] >= stake && bals["XUSD"] > bestXUSD {
best = p
bestXUSD = bals["XUSD"]
}
}
if best == nil {
fatal("no provider with sufficient resources and stake")
}
return best.Account
}
The stake parameter passed to pickProvider is hardcoded to literal 1 (pickProvider(c, vcpus, memory, disk, 1)) instead of computing core.LeaseStake(cost) beforehand.
In the XE protocol consensus rules (core/ledger.go:1675-1725), when a provider attempts to accept a lease (BlockLeaseAccept), consensus requires the provider to hold a minimum balance of LeaseStake(cost) (which is 10% to 50% of the total lease cost in XUSD).
Because pickProvider only checks bals["XUSD"] >= 1:
- It selects providers holding nominal balances (e.g., 0.000001 XUSD) who cannot satisfy
LeaseStake(cost). - The consumer commits XUSD escrow to a lease block that the selected provider cannot accept.
- The lease enters an unfillable pending state until timeout or cancellation, locking up consumer funds.
Additionally, pickSubmitNode (lines 1744-1760) hardcodes legacy testnet domains (https://ldn.core.test.network, https://ffm.core.test.network, https://nyc.core.test.network), causing block submission failures on mainnet or custom RPC networks.
Proposed Remediation
- Compute cost and stake before calling
pickProvider:// Pre-calculate estimated cost and stake with default or target multiplier estCost, _ := core.LeaseCost(vcpus, memory, disk, duration, core.PriceMultiplierDefault) reqStake := core.LeaseStake(estCost) providerAddr = pickProvider(c, vcpus, memory, disk, reqStake) - Refactor
pickSubmitNodeto dynamically query node peers fromc.NodeInfo()instead of static testnet hostnames.
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-10098 and says what differs; it is read like any other.