<!-- XE-0931 · SDK leaseCost accepts negative machine dimensions and computes a negative cost · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0931>. The page is the record; this is the same page for reading.*

XE-0931 · Bounty

# SDK leaseCost accepts negative machine dimensions and computes a negative cost

Closed · duplicate
—claimed Minor
web
filed 2026-11-06 18:39 UTC
by byfor8

Verdict
:   Duplicate

Tier
:   —

Claimed
:   Minor

Area
:   SDK / docs / web

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-14 22:53 UTC

Told
:   2026-11-14 22:53 UTC

### Patches

None linked.

### History

- [209975](https://bounty.xe.network/log/209975) 2026-11-14 22:53 UTC reply.sent
- [44770](https://bounty.xe.network/log/44770) 2026-11-08 20:32 UTC proposal.adopted
- [44769](https://bounty.xe.network/log/44769) 2026-11-08 20:32 UTC ticket.status new → closed
- [27627](https://bounty.xe.network/log/27627) 2026-11-08 11:07 UTC proposal.adopted
- [27626](https://bounty.xe.network/log/27626) 2026-11-08 11:07 UTC proposal.adopted
- [27625](https://bounty.xe.network/log/27625) 2026-11-08 11:07 UTC ticket.facts
- [27624](https://bounty.xe.network/log/27624) 2026-11-08 11:07 UTC proposal.adopted
- [27623](https://bounty.xe.network/log/27623) 2026-11-08 11:07 UTC ticket.facts
- [27622](https://bounty.xe.network/log/27622) 2026-11-08 11:07 UTC proposal.adopted
- [27621](https://bounty.xe.network/log/27621) 2026-11-08 11:07 UTC ticket.facts
- [27620](https://bounty.xe.network/log/27620) 2026-11-08 11:07 UTC proposal.adopted
- [27619](https://bounty.xe.network/log/27619) 2026-11-08 11:07 UTC ticket.facts

[Full history](https://bounty.xe.network/log?ref=XE-0931) · [JSON](https://bounty.xe.network/v1/tickets/XE-0931) · [markdown](https://bounty.xe.network/XE-0931.md)

### Report

## Summary

leaseCost is the SDK helper that turns vcpus, memoryMb, diskGb, duration, and a price multiplier into an XUSD quote for openLease and auto-select cheapest. At sdk/src/lease.ts:35-44 it rejects a non-positive multiplier, a non-positive duration, and a zero perHour, then multiplies the three machine dimensions with no sign check, so vcpus\=-1 with otherwise honest args returns a negative 148\. pricePerMinute at :17-19 calls the same helper, so it returns a negative 331 for vcpus\=-1 as well. A consumer quoting a provider advertisement, or a UI that auto-selects the cheapest offer, reaches this path on ordinary SDK calls without talking to the node first. GitHub #42 is quorum substitution and desk XE-0705 is the missing node duration bounds on the same helper; the gap here is the missing sign check on machine dimensions.

## Affected components

sdk/src/lease.ts:35-44 leaseCost (no sign check on vcpus, memoryMb, diskGb); sdk/src/lease.ts:17-19 pricePerMinute (calls leaseCost) at sdk 0dbc92ecff709bee79768e4e37788c682a0f4525.

## Impact

Auto-select cheapest can surface a negative XUSD quote and openLease will accept the job object with that cost. The node refuses the lease block so funds do not move; the user still acted on a bogus price and the job fails. Anyone who can feed dimensions into leaseCost or pricePerMinute can trigger it, including a provider advertisement with negative vcpus or memoryMb.

## PoC

```
#!/usr/bin/env node
/** A2 — leaseCost/openLease/quote accept negative machine dimensions. */
import { leaseCost, pricePerMinute } from './sdk.mjs'

const PIN = '0dbc92ecff709bee79768e4e37788c682a0f4525'
console.log(`PROVENANCE: sdk=${PIN} file=poc/round3/a2_negative_lease.mjs`)

const ctrl = leaseCost({ vcpus: 1n, memoryMb: 1024n, diskGb: 1n }, 60n, 1000n)
console.log(`CONTROL leaseCost(vcpus=1,mem=1024,disk=1,60s,mult=1000) = ${ctrl}`)

let neg
let threw = ''
try {
  neg = leaseCost({ vcpus: -1n, memoryMb: 1024n, diskGb: 1n }, 60n, 1000n)
} catch (e) {
  threw = String(e)
}
console.log(`ATTACK leaseCost(vcpus=-1,mem=1024,disk=1) threw=${JSON.stringify(threw)} result=${neg}`)

const ppm = pricePerMinute({ vcpus: -1n, memoryMb: 0n, diskGb: 0n }, 1000n)
console.log(`ATTACK pricePerMinute(vcpus=-1) = ${ppm}`)

const allNeg = leaseCost({ vcpus: -2n, memoryMb: -1024n, diskGb: -1n }, 60n, 1000n)
console.log(`ATTACK leaseCost(all negative dims) = ${allNeg}`)

if (ctrl > 0n && (neg < 0n || ppm < 0n || allNeg < 0n) && !threw) {
  console.log('PASS: negative vcpus/memory/disk produce a negative cost; CONTROL positive dims are positive')
  console.log('VERDICT=CONFIRMED')
  process.exit(0)
}
console.log(`KILL: ctrl=${ctrl} neg=${neg} ppm=${ppm} allNeg=${allNeg} threw=${threw}`)
console.log('VERDICT=KILLED')
process.exit(0)
```

```
ATTACK leaseCost(vcpus=-1,mem=1024,disk=1) threw="" result=-148
ATTACK pricePerMinute(vcpus=-1) = -331
PASS: negative vcpus/memory/disk produce a negative cost
```

## Suggested fix

## Reject negative vcpus, memoryMb, and diskGb in leaseCost before multiplying, and let pricePerMinute inherit that rejection. Do not return a quote for a machine that cannot exist.

### Thread

**XE desk**team2026-11-14 22:53 UTCdesk

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-0931 and says what differs; it is read like any other.
