`pendingOffers` flood + offer displacement: unauthenticated offers block legitimate leases and steer a victim's lease to an attacker-chosen provider
Report
Suggested tier: Medium
XE address (reward destination): 9b663fdac108be34a3b715ef78a9f9bd878af6ef8142f388c6514918e6852dd7
Summary
node/node.go, handleMarketplace (offer case, ~l.1404–1425) stores an incoming marketplace offer after verifying only its signature — with three missing checks, all in one place:
- No request-ownership check. Offers are stored for any
RequestID, including IDs this node never issued. There is no record of outgoing requests to compare against. - Single slot per RequestID, last-write-wins. No timestamp comparison, no price/dimension check, no first-seen-wins. Any later offer for the same RequestID silently displaces the earlier one.
- Hard cap of 1000 with silent drop. Once the map is full, every further offer is dropped (
len < 1000gate) — including legitimate ones. The 60 s prune only runs on ingest of another offer, and only evicts pre-existing entries.
There is no barrier to entry: core.VerifyPayloadKey (used by VerifyOffer) only checks that the pubkey derives the claimed account address — it never checks that the account exists on the ledger, holds any balance, or has stake. A fresh throwaway keypair can sign valid offers.
Impact
Honestly bounded — no direct theft. The lease block the consumer builds is still validated by the ledger (validateAndAddLease re-checks cost vs. the pinned certificate, cert ownership and expiry), and an unaccepted lease is refundable via cancel, so the victim's funds are locked/delayed, not stolen. What the attacker gains is:
- (a) Network-wide denial of lease creation while the flood runs. Sustaining it costs ~17 fresh offers/s (one 1000-offer refill per 60 s prune window) — trivial — and it hits every node, because gossip propagates the offers network-wide and every node runs the same handler. Gossip peer-scoring does not mitigate: valid messages incur no
InvalidMessageDeliveriespenalty, and there is no per-topic rate limit ingossipOptions. - (b) Steering a victim's lease to a provider of the attacker's choosing (including themselves, with no stake —
LeaseStakereturns 0 whileLeaseStakeDivisor == 0— and, per #392, a self-issued certificate). The attacker's offer is freshly signed (new timestamp/signature), so gossipsub's 120 s duplicate-suppression does not apply. - A consumer asking for 8 vCPUs can also silently receive fewer:
RequestAndCreateLeasenever checksoffer.VCPUs/MemoryMB/DiskGB/Durationagainst the request (honest providers copy the request dims, but nothing enforces it).
Steps to reproduce
Unit tests against the real node code (github.com/xeprotocol/xe, testnet-0005, commit 89a542e):
git clone https://github.com/xeprotocol/xe
cd xe
cp market-node_test.go node/
cp market-net_test.go net/
go test ./node -run TestMarket -v -count=1
go test ./net -run TestMarket -v -count=1
Note: 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.
PoC 1a — flood blocks a legitimate offer (TestMarketPendingOffers_FloodBlocksLegit, in market-node_test.go): feed 1000 distinct self-signed offers (fresh keypair, random RequestIDs) through the real handleMarketplace, then a legitimate offer for victim-request.
Expected: the legitimate offer is stored.
Actual (reproduced 2026-11-13): the map holds 1000 attacker offers; the legitimate offer is not stored. The victim consumer's RequestLease polls for 30 s and returns no offer received within 30s.
CONFIRMED: 1000 attacker offers fill pendingOffers cap; legitimate offer for a real request is dropped (RequestLease would time out after 30s)
PoC 1b — targeted displacement / lease steering (TestMarketPendingOffers_LastWriteWinsAndStaleStored): a legitimate offer (provider L, TotalCost 517) for request req-R is stored; then an attacker's offer for the same req-R (different provider, TotalCost 9999, older timestamp) is fed — it overwrites the legitimate offer. RequestLease polls every 500 ms and returns whatever is in the map, so the consumer's RequestAndCreateLease builds the lease against the attacker's offer instead. The same test shows a 1-hour-old offer is stored for a fresh request ID — incoming offers are never freshness-checked.
CONFIRMED: later offer (different provider, 9999 vs 517, older ts) overwrote legit offer for same RequestID — single-slot map, no timestamp/price/matching check; RequestLease polls first-seen and would take the attacker's offer
CONFIRMED: offer with 1-hour-old timestamp is stored in pendingOffers (incoming offers are never freshness-checked)
Supporting PoC — no account needed (TestMarketFlood_AttackerNeedsNoAccount, in market-net_test.go, go test ./net -run TestMarket -v -count=1 → PASS 6/6): 1000/1000 self-signed offers from a fresh, never-funded keypair all verify.
CONFIRMED: 1000/1000 self-signed offers from a fresh, never-funded keypair all verify — flood needs no account, stake, or prior request
Root cause
node/node.go, handleMarketplace (offer case):
n.pendingOffersMu.Lock()
cutoff := time.Now().Add(-60 * time.Second).UnixNano()
for id, o := range n.pendingOffers {
if o.Timestamp < cutoff { delete(n.pendingOffers, id) } // prunes OLD entries only
}
if len(n.pendingOffers) < 1000 {
n.pendingOffers[msg.Offer.RequestID] = msg.Offer // unconditional overwrite
}
n.pendingOffersMu.Unlock()
No outgoing-request tracking, no per-RequestID offer set or first-seen-wins, no freshness check on the incoming offer, and a hard cap that drops legitimate offers once full. The gossip entry (net/gossip_validate.go, marketplaceValidator) likewise applies no freshness or request-ownership check.
Suggested fix
Track outgoing request IDs with an expiry; store offers only for requests this node issued; keep all offers per RequestID (or first-seen-wins) and let RequestLease pick (e.g. cheapest valid, or explicit provider choice); enforce a freshness window on offer.Timestamp (e.g. 60 s, matching the prune); rate-limit / per-provider cap on pendingOffers inserts; validate offer dims against the request before returning it.
Controls verified (same PoC files, all PASS)
- 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). TotalCost/Timestampforgery is rejected — both fields are signature-covered; only exact replays pass (TestMarketTamper_TotalCostAndTimestampSigned). Even a tampered cost could not create a bad lease (ledger recomputesLeaseCostfrom the pinned cert).- Stale-price lease via a replayed offer is not reachable through the honest consumer flow:
RequestLeasegenerates a freshRequestIDper call and only accepts offers for it, and the ledger re-verifies cost against the pinned certificate. - Directory impersonation / registration replay is neutralised (monotonicity + 30 min TTL,
TestMarketDir_MonotonicityRejectsOldReplay,market-dir_test.go).
market-node_test.txt market-net_test.txt market-dir_test.txt
Thread
Thanks. This is the same finding as https://bounty.xe.network/XE-0106, 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-13372 and says what differs; it is read like any other.