Provider Resource Oversubscription Race: autoAcceptLease checks acceptPolicy.Allow before blockCreateMu permitting concurrent VM capacity exhaustion
Report
Vulnerability Summary
In node/node.go:1460-1535, autoAcceptLease(leaseBlock *core.Block) handles automated acceptance of incoming compute lease blocks for provider nodes.
To prevent oversubscribing provider hardware (CPU cores, RAM, and disk space), the provider node relies on n.acceptPolicy.Allow(leaseBlock, n.activeLeaseCount()):
func (n *Node) activeLeaseCount() uint64 {
if n.VMManager == nil {
return 0
}
return uint64(len(n.VMManager.List()))
}
In node/node.go:1477:
if err := n.acceptPolicy.Allow(leaseBlock, n.activeLeaseCount()); err != nil {
log.Printf("Auto-accept policy rejected lease %s: %v", shortHash(leaseBlock.Hash), err)
return
}
Notice the critical concurrency race condition:
n.acceptPolicy.Allowis checked early outside ofn.blockCreateMuand beforen.acceptAttestations(which performs network I/O across timekeeper peers taking hundreds of milliseconds to seconds).n.activeLeaseCount()counts only VMs currently returned byn.VMManager.List().- In-flight lease acceptances (which have passed policy check but have not yet completed block creation and VM provisioning in
n.VMManager.Provision) are completely invisible ton.activeLeaseCount()andn.acceptPolicy.Allow!
Vulnerable Code Locations
node/node.go:1477-1510:autoAcceptLeaseevaluatesn.acceptPolicy.Allowusingn.activeLeaseCount()at line 1477. Then it performs network attestation gathering (acceptAttestations) without holdingblockCreateMu. Multiple concurrent lease requests all read the same un-updated VM count.node/policy.go:33-45:LeaseAcceptPolicy.Allowenforcesp.MaxActiveLeases > 0 && activeCount >= p.MaxActiveLeases. BecauseactiveCountcomes solely fromn.activeLeaseCount(), concurrent leases bypassMaxActiveLeases.
Attack & Failure Scenario
- A provider configures
MaxActiveLeases = 2to safely fit within its hardware capacity (e.g. 16 vCPUs total, 8 vCPUs per lease). - A consumer broadcasts 5 simultaneous
BlockLeaserequests targeting this provider. - The provider node receives all 5 blocks and spawns 5 concurrent goroutines running
autoAcceptLease. - All 5 goroutines call
n.activeLeaseCount(). Since 0 VMs are provisioned yet, all 5 goroutines seeactiveCount = 0and passn.acceptPolicy.Allow. - All 5 goroutines gather attestations in parallel and acquire
n.blockCreateMusequentially. - The provider commits 5
BlockLeaseAccepttransactions on-chain, committing 5x XUSD stake. - Subsequently, when the provider attempts to provision VMs for all 5 leases, the host physical server runs out of vCPUs / memory, leading to hypervisor OOM panics, VM launch failures, and subsequent slashing of the provider's reputation and staked XUSD deposits!
Impact
- Provider Slashing & Stake Loss:
Providers accept more leases than their physical hardware can support, failing to provision VMs and forfeiting their XUSD stakes via
BlockLeaseForceSettle. - Host Node Denial of Service / Crash: Hypervisors crash or enter kernel OOM states under severe CPU/RAM overcommitment.
Remediation
Track pending in-flight accepts inside activeLeaseCount() or enforce acceptPolicy.Allow atomically under blockCreateMu accounting for in-flight accepted leases:
func (n *Node) activeLeaseCount() uint64 {
n.acceptInFlightMu.Lock()
inFlight := uint64(len(n.acceptInFlight))
n.acceptInFlightMu.Unlock()
var vmCount uint64
if n.VMManager != nil {
vmCount = uint64(len(n.VMManager.List()))
}
return vmCount + inFlight
}
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-9818 and says what differs; it is read like any other.