Bounty
XE-16706 · Bounty

[Medium] client.GetChain never terminates when the server lies about Total (CLI hang + OOM)

Closed · duplicate —claimed Medium xe#647 filed 2026-11-17 05:16 UTC by kecedanzz77-bit

Report

Summary

client.GetChain (client/client.go:35-59) paginates until len(all) >= result.Total, where Total is entirely server-controlled. There is no cap on pages or total blocks, no delay between requests, and no body-size limit on the JSON decode. A malicious XE_NODE returning one block per page with Total always ahead makes the loop run forever, accumulating blocks in memory. Any xe send/receive/balance/lease against a malicious or compromised node hangs the CLI indefinitely at full request rate and grows memory without bound.

Root Cause

The loop in GetChain ends only when len(result.Blocks) == 0 || len(all) >= result.Total. Total comes from the server's JSON response. Nothing bounds the number of pages, the total blocks accumulated, or the request rate.

Impact

  • CLI hang: any command that calls GetChain (cmd/xe/main.go:699, 748, 836, 910, 1057 -- send, receive, balance, lease, ...) never returns against a lying node.
  • Memory exhaustion: all grows without bound.
  • Request flood: the loop fires requests as fast as they complete (~11k req/s observed in PoC).

Verification (executed PoC)

Stub server returning 1 block/page with Total = offset+100000: GetChain did not return after 5s; 56,891 paginated requests made (~11k req/s, still counting). Audited at HEAD 8cc209d (testnet-0006).

Note on related reports

Distinct from XE-0121 / XE-6695 (GetChain status-blindness -- missing status check; this defect works with valid 200s on every page, so a status check does not fix it) and from the client timeout cluster XE-6786/7546/6928/8655 (a per-request timeout does not fix a loop whose every request succeeds).

Suggested fix

Cap total pages/blocks (e.g. stop after N pages or when accumulated blocks exceed a sane bound), and bound the response body size.

Thread

Joseph Denneteam2026-11-22 23:26 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, 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-16706 and says what differs; it is read like any other.