Bounty
XE-13360 · Bounty

[Medium] Pending sends never expire, have no cap, and cost ~nothing — permanent state bloat via reclaimable dust

Accepted claimed Medium xe#384 filed 2026-11-11 12:52 UTC by akitaBugBounty

Report

Summary

A pending send, once admitted, lives forever in every node's state. There is no expiry/TTL/pruning, no per-account or global cap on pending sends, and the minimum send amount is 1 micro-XE (the only check in validateAndAddSend is amount == 0). Creating a pending costs one 32-bit PoW solve (~2^25 hashes at the live difficulty) plus 1 micro-XE locked in the pending — and that micro is fully reclaimable, because the attacker names their own second account as destination and receives it back. Net XE cost of a permanent pool entry: 0. There is no transaction fee anywhere in the codebase. The only cost is PoW, which parallelises perfectly across cores/machines.

Impact

  • Permanent, unbounded state growth on every node. Pending entries are stored in Badger (prefixPending 0x03 + destination index 0x04, store/badger_store.go:182-340) and deleted only by a receive (DeletePendingID) or a rollback/swap unwind. Nothing else ever removes them. Disk, memory, startup load and every pool-wide read grow forever.
  • Live network already shows the shape of it. On testnet-0005 (LDN, read-only GETs, 11 Nov 2026): 332,011 pending sends vs 865,339 blocks (~38%), and the pool grew +329 entries in ~40 min (332,011 → 332,340) while blocks grew +1,205. Random sample of 1,000 pendings: 90% are ≤ 1,000 micro-XE, 4.8% exactly 1 micro-XE; 39.2% older than 7 days; oldest ~19 days (23 Oct 2026) and still unclaimed. One source holds 79/1,000 sampled pendings (1 XE each to 79 distinct destinations). This looks like organic accumulation today, not an attack — which is the point: the protocol has no mechanism that would stop it becoming one.
  • Every pool-wide read pays the full price. GET /pending calls GetAllPending() (full Badger range scan) before slicing the page (api/handler.go:622-625); node observability also counts the whole pool per scrape (node/observability.go:213). The 2.05 s /pending response at 332k entries (see #70/#215 for the same pattern on other endpoints) gets slower as the pool grows, and the pool can only grow.
  • Availability, not funds. No XE is stolen and consensus does not break; the damage is resource exhaustion / node degradation. Hence Medium, not higher.

Root cause (repo github.com/xeprotocol/xe, commit 89a542ea51d38375299aee54c6c99102e9bfa666)

  1. PendingSend (core/types.go:141) carries no timestamp/expiry field at all — there is nothing to expire against. A repo-wide grep for expir/TTL/prune/purge touching pending returns nothing.
  2. validateAndAddSend (core/ledger.go:972) rejects only amount == 0, self-sends, and insufficient balance. No minimum amount above 1 micro, no per-account pending count check, no global cap.
  3. validateAndAddReceive (core/ledger.go:1081) is SOUND and is not the issue: it rejects a receive unless pending.Destination == receiver (:1097), credits exactly pending.Amount via the balance check (:1145), and deletes the pending atomically (:1156). No cross-account claim, no double-claim, no wrong-amount receive — verified by code read.
  4. No fee exists anywhere (grep for "fee" in core/, node/, api/ returns nothing relevant), so PoW is the only gate — and the live difficulty 0xfffff80000000000 (pow_difficulty on LDN) means ~2^25 (~33.5M) blake2b hashes per block.

PoC (all tests PASS)

File: core/xe06_pending_dust_test.go (test-only, no production code changed). Run with TMPDIR=$HOME/workspace/xe-audit/tmp GOPROXY=direct go test ./core/ -run TestXE06 -v:

  • TestXE06DustSendAccepted — a 1-micro-XE send is admitted and creates a pending entry.
  • TestXE06NoPerAccountPendingCap — 200 dust sends from a single account to 200 distinct destinations, all admitted; pool = 200, no cap fires.
  • TestXE06PendingNeverExpires — a pending created at T is still fully claimable at T + 365 days (receive succeeds; balance credited).
  • TestXE06DustFullyReclaimable — attacker sends 1 micro to their own alt account, receives it back, sends it back to the source: source balance restored to exactly 1,000,000 — net XE cost of a pool entry is 0.
  • TestXE06PoWCostAtLiveDifficulty — measured (this sandbox is slow/shared, so absolute seconds are a sandbox number; the invariant is the hash count): single-core 0.23 MHash/s → ~144 s/solve; 4 workers aggregate 0.28 MHash/s → ~122 s/solve. On unthrottled hardware the same 2^25 hashes take seconds, and the work parallelises perfectly — the binding constraint is aggregate hash power, not XE.

Honest limits: the PoC proves ledger acceptance and zero net XE cost, not a live flood — no load test was run (forbidden by the bounty scope) and no live transaction was sent. The live numbers above are read-only observations, and the +329/40 min growth is consistent with organic traffic as well as low-rate dust; the vulnerability is the absence of any bound, proven in code, not a demonstrated live flood.

Fix suggestion

  • Add an expiry to pending sends (e.g. TTL in blocks/time, after which the send is prunable and the sender's funds are reclaimable via a cancel/reclaim path — today there is no way for a sender to reclaim an unclaimed send at all).
  • Or enforce a minimum send amount and/or a per-account pending cap.
  • Or charge a fee / raise PoW for dust amounts. Any one of these bounds the pool; expiry + reclaim is the cleanest since it also fixes the stranded-funds side effect.

Distinct from

  • #70 / #215 / #365 / #78 — pagination/full-lattice cost of the read endpoints. This report is about the state itself (unbounded, never-expiring pool), not the cost of reading it; fixing pagination would not shrink the pool.
  • #347 — pre-notice of a latency measurement on GET /pending, not a finding.
  • #312 (dust XUSD receives vs DAO vote snapshot), #53 (PoW-gated gossip spam), #156 (directory TTL), #161 (votes persisted forever), #247 (chat messages map) — different subsystems/mechanisms.
  • #323 (receive timestamp skew) — different; receive validation was checked here and is sound on destination/amount/double-claim.

Environment

  • Codebase: github.com/xeprotocol/xe @ 89a542e (2026-11-10)
  • Go 1.25.0, go test as above, local reproduction only (live testnet used only for read-only observations)

XE payout address: e3d3e4407fec5a846201c7ed8560484ffb881cc30068745a110dd8efb824500c

Thread

XE deskteam2026-11-18 08:55 UTCgithub

Read and accepted. It is tracked internally and the fix will land in a public PR; this issue is updated when it does, and the tier and award follow the fix. The desk entry is https://bounty.xe.network/XE-13360.