{"id":"XE-13376","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"530","source_url":"https://github.com/xeprotocol/xe/issues/530","reporter_id":2252,"title":"Signed marketplace requests never expire: a request signed in 2020 still passes validation, enabling replay amplification","area":"p2p-sync","claimed_tier":"minor","assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-0009","tracked":true,"internal_ref":"#1100","internal_url":"https://github.com/xeprotocol/core/issues/1100","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:13.489230+00:00","updated_at":"2026-11-20T00:53:19.058119+00:00","source_created_at":"2026-11-13T03:21:50+00:00","told_at":"2026-11-20T00:51:01+00:00","status_changed_at":"2026-11-20T00:50:06.165720+00:00","url":"https://bounty.xe.network/XE-13376","body":"**Suggested tier:** Low\n\n**XE address (reward destination):** 9b663fdac108be34a3b715ef78a9f9bd878af6ef8142f388c6514918e6852dd7\n\n## Summary\n\n`net/gossip_validate.go`, `marketplaceValidator`, request case: the ONLY checks on an incoming marketplace request are (a) `request.Signature` valid over `request.PubKey`, and (b) timestamp not in the future (`request.Timestamp > now+1m`). There is NO freshness check on old timestamps, NO nonce, and NO expiry.\n\nSo a signed request can be replayed indefinitely. Any node that relays it will re-gossip it (the gossip validator passes it again), and any provider that sees it will treat it as a fresh request and send an offer. A single captured request can be replayed across the network forever, generating offer traffic and filling `pendingOffers` on every node (see issue #526 for the `pendingOffers` cap — a replayed request can be used to fill the cap with offers).\n\n## Impact\n\nReplay amplification: one signed request → unlimited replays → offer traffic on every node + `pendingOffers` exhaustion (1000-offer cap). The request itself cannot create a fraudulent lease (the consumer must sign the lease; the ledger re-verifies cost), so the impact is bounded to DoS / traffic amplification — hence Low.\n\n## Steps to reproduce\n\nUnit test against the real node code (`github.com/xeprotocol/xe`, testnet-0005, commit `89a542e`):\n\n```\ngit clone https://github.com/xeprotocol/xe\ncd xe\ncp market-node_test.go node/\ncp market-net_test.go net/\ngo test ./node -run TestMarket -v -count=1\ngo test ./net -run TestMarket -v -count=1\n```\n\nNote: `market-node_test.go` / `market-net_test.go` are NOT in the public repository — the PoC test files are attached to this issue; without them, the XE team cannot run this reproduction.\n\n**PoC 3 — signed request from 2020 passes validation** (`TestMarketRequest_NeverExpires`, in `market-net_test.go`): a request with `Timestamp` 2020-01-01 and a valid signature is fed through the real `marketplaceValidator`.\n\n**Expected:** the ancient request is rejected.\n**Actual (reproduced 2026-11-13):** the request passes validation and is re-gossiped.\n```\nCONFIRMED: signed request from 2020-01-01 passes validation (no expiry / freshness check)\n```\n\n## Root cause\n\n`net/gossip_validate.go`, `marketplaceValidator`, request case: no lower-bound timestamp check, no nonce, no expiry; `types/types.go`, `MarketplaceRequest` has no TTL field.\n\n## Suggested fix\n\nAdd a freshness window for requests (e.g. 60 s, matching the pendingOffers prune) and a nonce per consumer, or an expiry field in `MarketplaceRequest` checked on ingest.\n\n## Controls verified (same PoC files, all PASS)\n\n- Cross-context signature reuse (ad ↔ request ↔ offer) is rejected — distinct domain tags (`xe/marketplace-advertisement/v1`, `-request/v1`, `-offer/v1`) plus different field sets (`TestMarketCrossContext_SignatureReuseRejected`).\n- `TotalCost` / `Timestamp` forgery is rejected — both fields are signature-covered; only exact replays pass (`TestMarketTamper_TotalCostAndTimestampSigned`). Even a tampered cost could not create a bad lease (ledger recomputes `LeaseCost` from the pinned cert).\n- Stale-price lease via a replayed offer is not reachable through the honest consumer flow: `RequestLease` generates a fresh `RequestID` per call and only accepts offers for it, and the ledger re-verifies cost against the pinned certificate.\n- Directory impersonation / registration replay is neutralised (monotonicity + 30 min TTL, `TestMarketDir_MonotonicityRejectsOldReplay`, `market-dir_test.go`).\n\n[market-node_test.txt](https://github.com/user-attachments/files/34781635/market-node_test.txt)\n[market-net_test.txt](https://github.com/user-attachments/files/34781634/market-net_test.txt)\n[market-dir_test.txt](https://github.com/user-attachments/files/34781633/market-dir_test.txt)","patch_refs":[{"id":574,"repo":"xeprotocol/xe","kind":"pr","ref":"537","title":"fix(net): add timestamp freshness and expiry validation to marketplace requests (fixes #530)","url":"https://github.com/xeprotocol/xe/pull/537","note":"","state":"open","author":"tipprb","added_by":"desk","created_at":"2026-11-14T20:42:20.269758+00:00"}],"thread":[{"id":13548,"source":"github","source_ref":"7026824424","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0009, 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-13376 and says what differs; it is read like any other.","created_at":"2026-11-20T00:51:01+00:00"}]}