Bounty
XE-0104 · Bounty

node: `LeaseAcceptPolicy` is only consulted for `lease_open` — a unilateral `lease_renew` bypasses the provider's duration and cost caps

Triaging claimed Medium xe#162 filed 2026-10-29 02:54 UTC by memekomik

Report

Suggested tier: Medium (2,500 XE) — an accepted lease can be extended 8,760× past the provider's own policy limits without the provider's consent. Repo pin: 978785929bc17a2f4ab30c383e5fc9cf4d634512 (testnet-0005) Area: node/policy.go, node/node.go (renewal path), core/lease_renew.go

Summary

Providers configure LeaseAcceptPolicy — MaxDurationSec, MaxCostXUSD, resource ceilings — and the node applies it in exactly one place: acceptPolicy.Allow is called only from autoAcceptLease (node/node.go:1477), which only runs for a BlockLease (node/node.go:721). lease_renew never consults it: validateAndAddLeaseRenew caps the cumulative duration at LeaseMaxDuration (1 year) and recomputes the price, but knows nothing about the provider's policy. The consumer signs renewals unilaterally; the provider's node has no say.

So a 1-hour lease accepted under a 1-hour policy can be walked to 31,536,000 s and past the provider's MaxCostXUSD one renewal at a time, while the same commitment as a fresh lease_open would be refused outright.

Where

node/node.go:1477 — the only caller in the tree (grep -rn 'acceptPolicy.Allow' → one hit):

if !n.acceptPolicy.Allow(leaseBlock, core.Now()) {
    log.Printf("Auto-accept policy rejected lease %s: %v", shortHash(leaseBlock.Hash), err)
    return
}

core/lease_renew.go:39-52 — the renewal path only bounds duration against the protocol cap:

newEffective, ok := safeAdd(lease.EffectiveDurationSecs(), b.Duration)
if !ok || newEffective > LeaseMaxDuration {
    return fmt.Errorf("lease_renew: cumulative duration %d + %d exceeds max %d",
        lease.EffectiveDurationSecs(), b.Duration, LeaseMaxDuration)
}

and node/policy.go is not referenced from it at all.

Reproduction

Full lease lifecycle against the real ledger, with a provider policy of MaxDurationSec = 3600, MaxCostXUSD = 500000000:

cd /root/xe-audit/poc-D
nice -n 15 taskset -c 0-1 go test ./auditpoc/ -run TestD3 -count=1 -v

Observed (poc-D/observed-D.log):

d3_policy_renew_test.go:49:  policy allows the 1h lease (cost 80000 micro-XUSD)
d3_policy_renew_test.go:62:  control: the same policy rejects a lease_open for 31536000s (700800000 micro-XUSD): duration 31536000s > policy max 3600s
d3_policy_renew_test.go:94:  renewal accepted: +31532400s for 700720000 micro-XUSD (701 XUSD) — over the policy by 8760× in duration and 1.40× in price
d3_policy_renew_test.go:112: lease now expires 8759h0m0s after the point where the provider's policy would have ended it
d3_policy_renew_test.go:115: RESULT: LeaseAcceptPolicy.MaxDurationSec=3600 and MaxCostXUSD=500000000 were enforced on lease_open and bypassed by a unilateral lease_renew to 31536000s / 700720000 micro-XUSD

The control line is the point: the identical commitment is rejected as a lease_open by the provider's own policy and accepted as a renewal.

Impact

  • The provider's advertised terms (MaxDurationSec, MaxCostXUSD, resource caps) are one-shot: they bind the initial lease and then stop mattering. A provider that prices capacity hourly and caps at one hour is committed for a year at that price.
  • The consumer needs no cooperation from the provider: lease_renew is consumer-signed, and the renewal is admitted by the ledger as long as the attestations, certificate and price check out.
  • Practical consequence for providers: capacity sold on the assumption of hourly re-pricing is rented for a year, and the price is pinned to the certificate multiplier in force at the renewal — the same class of commitment risk #97 describes, but for size rather than price.

Why this is not a duplicate of #97 / #105 / #120 / #93

  • #97 / #105 / #120 fix which certificate a renewal may use (the provider's current one) and thus the price multiplier. They do not bound the duration or total cost a renewal may commit to; even with the current certificate, the 1-year extension in the PoC passes.
  • #93 / #110 / #152 are about the signature threshold on lease_accept.
  • #21 / #90 are about settling without service.

The policy-compulsion gap is not covered by any of them.

Suggested fix

  1. Call acceptPolicy.Allow for renewals too, evaluating the projected lease (EffectiveDurationSecs()+b.Duration, Cost+ΣrenewalCost+b.Amount) rather than the original block.
  2. If the policy rejects a renewal, the provider's node should not attest it (the attestation is the provider's consent point — validateAndAddLeaseRenew already requires timekeeper attestations gathered by the provider's node).
  3. Surface MaxDurationSec / MaxCostXUSD in GET /providers so a renter can see the caps the provider will actually enforce.

Notes

Source-level only; no traffic to testnet-0005. PoC in /root/xe-audit/poc-D/auditpoc/d3_policy_renew_test.go.

Thread

fangjian-bit2026-10-29 08:59 UTCgithub

Submitted architectural fix and comprehensive regression test suite in #180.

Resolves the unilateral renewal bypass by introducing consensus-level committed lease caps (FeatureLeaseCaps), binding provider duration/cost policies into lease_accept caps, enforcing immutable WithinRenewalCaps verification in validateAndAddLeaseRenew, and hardening VM orphan cleanup. Verified with full unit tests and builds in native Linux Go 1.27.3.

Joseph Denneteam2026-11-08 20:32 UTCgithub

Thanks for the report. We have read it against the code and the behaviour you describe is as designed today; we are reviewing whether renewals should be bound by provider policy and will update this ticket when a decision is made.