Bounty
XE-1730 · Bounty

Node-supplied provider certificates are never verified: the SDK prices and signs a lease from a forged certificate

Triaging claimed Minor web filed 2026-11-09 01:37 UTC by Darkarmy921

Report

Summary

XeClient.certificate() takes whatever the node returns for /certificate/<provider> and hands it to the caller as a trusted Certificate, and Xe.openLease() prices the lease from that certificate and signs the lease block — with no verification of any kind. A forged certificate (hash f…f that was never issued, a provider field naming a different account than the one requested, a price multiplier of 999999 — 100× the legal maximum — and no signature at all) was accepted without error, and openLease() then priced and signed a lease at the forged price (amount 667,000 micro-XUSD for 1 vCPU / 512 MB / 10 GB for 60 s). The typed Certificate carries only hash, provider, priceMultiplierMilli and expiresAt; toCertificate keeps the raw record but the SDK never checks the signature, never checks that the certificate's provider is the provider that was asked for, and never checks the multiplier against its legal range. There is no verifyCertificate function anywhere in the SDK source: verification is impossible in principle from the typed object, and no code path attempts it.

One half of the original recon claim is refuted and is not part of this finding: the attestation half. Timekeeper attestations are verified — gatherAttestations checks the signing key and the signature before using an attestation, and a garbage attestation is rejected (see "Refuted half" below). This report covers only the provider-certificate half, which was reproduced.

An honest node re-validates the lease before it lands (see "Node backstop"), so a forged certificate cannot move funds on an honest node. The remaining harm is against a malicious or compromised node: it can make the SDK quote, and the caller sign, a lease at a false price — and the caller has no SDK-side signal that anything is wrong.

Impact

  • A malicious or compromised node can make the SDK quote and sign a lease at a false price. The caller asked to lease from provider P; the node returns a certificate naming a different provider with a 999999× multiplier; the SDK prices from it (667,000 micro-XUSD for a 60-second 1-vCPU lease that should cost 667 at a 1.0× multiplier) and signs the lease block embedding the forged hash. The only SDK-side guard is the caller's own maxPricePerMinute ceiling, which is optional — and a caller who set no ceiling gets no warning at all.
  • Escrow is committed on the strength of an unverified claim. The lease block locks XUSD escrow for the forged amount. On an honest node the block is rejected at submission (node backstop), so the escrow never lands — but the caller has signed a block asserting a price the certificate never supported, and against a node the caller trusts (or a node that is the provider) there is no independent check.
  • No funds move on an honest node. The ledger looks the certificate up by hash in its own store, checks provider and expiry, and recomputes the cost — a forged certificate fails all three. That is why the severity is Low, not Medium.

Severity reasoning

  • Low, not Medium: the forged certificate is rejected by the honest node's own validation before anything lands, so no funds move and no lease is created. The defect needs a malicious or compromised node to matter, and the SDK's threat model already places some trust in the node it talks to.
  • Low, not Minor: the missing check is total — not a weak check, but the absence of any verification function in the SDK — and it sits on the money path: the certificate is literally what a lease is priced against. A caller leasing from a node it does not fully trust (the normal case for an agent renting a machine from a stranger's provider) has no SDK-side way to know the price is genuine. The fix is also cheap: check the provider field, the multiplier range, and the signature against the provider's key.

Root cause

  1. toCertificate discards everything verifiable. src/client.ts:463-470 maps the raw record to { hash, provider, priceMultiplierMilli, expiresAt, raw }. The Certificate interface (src/client.ts:54-66) has no signature, no score, and no provider-public-key field. The raw record is kept, but no code reads a signature from it.
  2. No verify function exists. A grep over src/ finds no verifyCertificate and no verification of a certificate anywhere. Contrast attestations, where verifyAttestation exists and is called (see "Refuted half").
  3. openLease() trusts the certificate it is handed. src/xe.ts:266-283: it fetches certificate(provider), checks only expiry (expiresAt !== 0n && expiresAt <= nowNs(), :272-274) — which a forged certificate defeats by setting expiresAt: 0 ("no expiry") — then prices with pricePerMinute(dims, certificate.priceMultiplierMilli) (src/lease.ts:17-18, leaseCost at :35-44) and signs a lease block embedding certificateHash: certificate.hash. It never checks that certificate.provider === provider, never checks the multiplier against its legal range (500–10000, xe/perf/certificate.go:56-57), and never verifies a signature.

Refuted half (stated plainly — NOT part of this finding)

The recon claim also covered timekeeper attestations. That half is refuted: src/attestation.ts:14-19 (verifyAttestation) verifies the signature over the lease hash and timestamp, and gatherAttestations (src/attestation.ts:79-110, check at :94) rejects any attestation whose public key is not the timekeeper's or whose signature does not verify. The harness confirmed it: verifyAttestation on a bogus signature ('00'×64) returns false, and gatherAttestations threw gathered 0 of 1 attestations: http://mock-tk: attestation did not verify. Do not file the attestation half as a bug.

Node backstop (why no funds move on an honest node)

validateAndAddLease (xe/core/ledger.go:1506, certificate checks at :1529-1553) looks the certificate up by hash in the node's own store (certificate %s not found, :1537), checks that it belongs to the lease destination (certificate %s belongs to %s, not lease destination %s), checks expiry against the block timestamp, and recomputes the cost from the stored multiplier (lease cost mismatch: expected %d (multiplier %d), got %d, :1552). A forged hash fails the lookup; a wrong provider fails the provider check; a 999999 multiplier fails the cost recompute.

Reproduction

A. Harness run (primary evidence — PASS, 0 failures)

Script /tmp/sdk-verify/verify.mjs (SDK-2 section), run from the built SDK (~/workspace/xe-bounty/sdk, dist/ already built). Mock fetch only, no network, no live node. The mock answers /certificate/<provider> with a forged certificate: hash 'f'×64, provider = a different freshly created wallet, price_multiplier_milli: '999999', expires_at: '0', no signature field at all:

cd ~/workspace/xe-bounty/sdk
node /tmp/sdk-verify/verify.mjs

Observed output (re-run 2026-11-09):

=== SDK-2: provider certificate ===
client.certificate() returned forged cert without error: {"hash":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","provider":"939238ab11617e747d10dffaf9a07dd28116e8d899c1e1b8f9e792882cc5df29","priceMultiplierMilli":"999999","expiresAt":"0","raw":{"hash":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","provider":"939238ab11617e747d10dffaf9a07dd28116e8d899c1e1b8f9e792882cc5df29","price_multiplier_milli":"999999","expires_at":"0"}}
PASS SDK-2 cert: client.certificate accepts forged cert (wrong provider, mult 999999, no sig) provider=939238ab1161 mult=999999
openLease submitted wire: {"type":"lease","account":"0d26b6e68feacfbd06aa7efba18b7f86810fbfbbb634716d7b6eb80f5a66d9c5","previous":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","balance":999999333000,"timestamp":1794186424070000000,"asset":"XUSD","hash":"af7dc77757e027760c96dc70c68b4b972effc2b6eea8cf94843443ca4b61332c","signature":"1a62bbdcdb808b91dce67bbab37bf759d5be5c21aaf6ac5a32e20d6accb4b8eea4a165d1427c725a3eec1f19251960a234d28cf16225d9cae7f3a72472fc1d04","pow_nonce":1572465068282574300,"destination":"27dc6bbda544ee54c1c2f72a9229932f49df43c9bb26bef3b69270ccd37d28d3","amount":667000,"vcpus":1,"memory_mb":512,"disk_gb":10,"duration":60,"certificate_hash":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"}
PASS SDK-2 openLease: signs lease priced from forged cert, hash embedded cert_hash=ffffffffffff amount=667000 dest==provider=true
PASS SDK-2: no verifyCertificate/verify function exists in SDK src grep: no verify*Certificate in src/; toCertificate (client.ts:463) drops signature/provider_pub_key/score
PASS SDK-2 attestation control: verifyAttestation(bogus sig)=false
gatherAttestations(bogus) threw: gathered 0 of 1 attestations: http://mock-tk: attestation did not verify
PASS SDK-2 attestation control: gatherAttestations rejects bogus attestation gathered 0 of 1 attestations: http://mock-tk: attestation did not verify

What the run shows:

  1. client.certificate() returned the forged certificate without error — wrong provider, multiplier 999999 (legal range 500–10000), no signature.
  2. openLease({ provider, vcpus: 1, memoryMb: 512, diskGb: 10, durationSecs: 60 }) priced the lease from the forged multiplier: leaseCost = ceil(667 × 999999 / 1000) = 667,000 micro-XUSD (at a 1.0× multiplier the same lease costs 667), and signed a lease block embedding certificate_hash: 'f'×64 with amount: 667000.
  3. The attestation control confirms the refuted half: a bogus attestation is rejected by verifyAttestation (false) and by gatherAttestations (throws attestation did not verify).

B. Honesty notes and preconditions

  • Precondition (stated plainly): the forged certificate must come from the node the SDK is talking to — i.e. a malicious or compromised node (or a node that is itself the provider). An honest node serves only certificates it issued, and its ledger rejects a forged one at submission.
  • No live node was used. Mock fetch in-process; no live testnet traffic, no real provider, no real lease, no real funds.
  • The maxPricePerMinute ceiling is not a substitute. It is optional, caller-supplied, and a ceiling on the price, not a verification of the certificate — it cannot tell a genuine 999× quote from a forged one below the ceiling.

Dedup note

No live desk-list check was performed in this drafting pass — the dedup below is against the closest items named in the verification record, and the live list should be re-checked before submission. No known report covers this finding:

  • XE-1655 (BlockLeaseRenew absent from ValidateStagedBlock) — node-side staged validation for a lease block type, a different check in a different component.
  • XE-2 (staged lease arm: no certificate/cost checks in ValidateStagedBlock) — node-side staging gap, again a different component; the SDK-side absence of any certificate verification is the distinct claim here.

No known report covers the SDK accepting and pricing from an unverified provider certificate. The attestation half is refuted (see above) and must not be filed.

Suggested fix direction

  • Verify the certificate in the SDK before pricing from it: check that certificate.provider is the provider that was requested, that priceMultiplierMilli is within the legal range (500–10000), and that the certificate's signature verifies against the provider's key (the signature/score fields need to survive toCertificate into the typed Certificate, or be verified from raw).
  • Reject in certificate() / certificateByHash() (fail at read time, so every consumer inherits the check) rather than only in openLease().
  • Keep the node as a second line of defence — it already re-validates — but do not rely on it as the only line: the SDK should not sign a lease priced from a certificate it never checked.

Payout address

052e33e0ed9c43e2bdf07faff9a90d25642b51d53d96f49f5d45b81f6584b3da

References (file:line; sdk @ 605c20a, xe @ HEAD as checked 2026-11-09)

Location What it shows
sdk/src/client.ts:54-66 Certificate interface: hash, provider, priceMultiplierMilli, expiresAt only — no signature/score
sdk/src/client.ts:313-315 certificate(): returns toCertificate(...) with no verification
sdk/src/client.ts:463-470 toCertificate: maps only the four fields (+ raw); nothing verifiable is carried typed
sdk/src/xe.ts:266-283 openLease(): expiry-only check (:272-274), then prices and signs from the certificate
sdk/src/lease.ts:17-18,35-44 pricePerMinute / leaseCost: price is a pure function of the certificate multiplier
sdk/src/attestation.ts:14-19 verifyAttestation: signature verification (the refuted half — this does exist)
sdk/src/attestation.ts:79-110 gatherAttestations: rejects attestations whose key/signature do not verify (:94)
xe/perf/certificate.go:56-57 Legal multiplier range: PriceMultiplierMin = 500, PriceMultiplierMax = 10000
xe/core/ledger.go:1506,1529-1553 validateAndAddLease: cert lookup by hash, provider + expiry checks, cost recompute
/tmp/sdk-verify/verify.mjs SDK-2 harness section (forged cert, 999999 multiplier, amount 667000; 0 failures) — ephemeral, see "Reproduction" for the verbatim output

Thread

Nothing public yet.