{"id":"XE-0931","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":13,"title":"SDK leaseCost accepts negative machine dimensions and computes a negative cost","area":"sdk-docs-web","claimed_tier":"minor","assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-06T18:39:20.657817+00:00","updated_at":"2026-11-14T22:53:53.253898+00:00","source_created_at":null,"told_at":"2026-11-14T22:53:53.495651+00:00","status_changed_at":"2026-11-08T20:32:08.892506+00:00","url":"https://bounty.xe.network/XE-0931","body":"## Summary\r\nleaseCost 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.\r\n\r\n## Affected components\r\nsdk/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.\r\n\r\n## Impact\r\nAuto-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.\r\n\r\n## PoC\r\n\r\n```javascript\r\n#!/usr/bin/env node\r\n/** A2 — leaseCost/openLease/quote accept negative machine dimensions. */\r\nimport { leaseCost, pricePerMinute } from './sdk.mjs'\r\n\r\nconst PIN = '0dbc92ecff709bee79768e4e37788c682a0f4525'\r\nconsole.log(`PROVENANCE: sdk=${PIN} file=poc/round3/a2_negative_lease.mjs`)\r\n\r\nconst ctrl = leaseCost({ vcpus: 1n, memoryMb: 1024n, diskGb: 1n }, 60n, 1000n)\r\nconsole.log(`CONTROL leaseCost(vcpus=1,mem=1024,disk=1,60s,mult=1000) = ${ctrl}`)\r\n\r\nlet neg\r\nlet threw = ''\r\ntry {\r\n  neg = leaseCost({ vcpus: -1n, memoryMb: 1024n, diskGb: 1n }, 60n, 1000n)\r\n} catch (e) {\r\n  threw = String(e)\r\n}\r\nconsole.log(`ATTACK leaseCost(vcpus=-1,mem=1024,disk=1) threw=${JSON.stringify(threw)} result=${neg}`)\r\n\r\nconst ppm = pricePerMinute({ vcpus: -1n, memoryMb: 0n, diskGb: 0n }, 1000n)\r\nconsole.log(`ATTACK pricePerMinute(vcpus=-1) = ${ppm}`)\r\n\r\nconst allNeg = leaseCost({ vcpus: -2n, memoryMb: -1024n, diskGb: -1n }, 60n, 1000n)\r\nconsole.log(`ATTACK leaseCost(all negative dims) = ${allNeg}`)\r\n\r\nif (ctrl > 0n && (neg < 0n || ppm < 0n || allNeg < 0n) && !threw) {\r\n  console.log('PASS: negative vcpus/memory/disk produce a negative cost; CONTROL positive dims are positive')\r\n  console.log('VERDICT=CONFIRMED')\r\n  process.exit(0)\r\n}\r\nconsole.log(`KILL: ctrl=${ctrl} neg=${neg} ppm=${ppm} allNeg=${allNeg} threw=${threw}`)\r\nconsole.log('VERDICT=KILLED')\r\nprocess.exit(0)\r\n```\r\n\r\n```\r\nATTACK leaseCost(vcpus=-1,mem=1024,disk=1) threw=\"\" result=-148\r\nATTACK pricePerMinute(vcpus=-1) = -331\r\nPASS: negative vcpus/memory/disk produce a negative cost\r\n```\r\n\r\n## Suggested fix\r\nReject 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.\r\n---","patch_refs":[],"thread":[{"id":3793,"source":"desk","source_ref":"reply:2535","author":"XE desk","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-0931 and says what differs; it is read like any other.","created_at":"2026-11-14T22:53:53.253898+00:00"}]}