<!-- XE-16706 · [Medium] client.GetChain never terminates when the server lies about Total (CLI hang + OOM) · testnet -->
*Markdown view of <https://bounty.xe.network/XE-16706>. The page is the record; this is the same page for reading.*

XE-16706 · Bounty

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

Closed · duplicate
—claimed Medium
[xe#647](https://github.com/xeprotocol/xe/issues/647)
filed 2026-11-17 05:16 UTC
by kecedanzz77-bit

Verdict
:   Duplicate

Tier
:   —

Claimed
:   Medium

Area
:   SDK / docs / web

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-22 23:26 UTC

Told
:   2026-11-22 23:26 UTC

### Patches

None linked.

### History

- [770288](https://bounty.xe.network/log/770288) 2026-11-22 23:26 UTC reply.mirror\_failed
- [770115](https://bounty.xe.network/log/770115) 2026-11-22 23:26 UTC proposal.adopted
- [770114](https://bounty.xe.network/log/770114) 2026-11-22 23:26 UTC reply.sent
- [770113](https://bounty.xe.network/log/770113) 2026-11-22 23:26 UTC ticket.status new → closed
- [769363](https://bounty.xe.network/log/769363) 2026-11-22 23:26 UTC proposal.adopted
- [769362](https://bounty.xe.network/log/769362) 2026-11-22 23:26 UTC ticket.facts area
- [769361](https://bounty.xe.network/log/769361) 2026-11-22 23:26 UTC proposal.adopted
- [769360](https://bounty.xe.network/log/769360) 2026-11-22 23:26 UTC ticket.facts
- [769359](https://bounty.xe.network/log/769359) 2026-11-22 23:26 UTC proposal.adopted
- [769358](https://bounty.xe.network/log/769358) 2026-11-22 23:26 UTC ticket.facts
- [766071](https://bounty.xe.network/log/766071) 2026-11-22 23:17 UTC note.added
- [766070](https://bounty.xe.network/log/766070) 2026-11-22 23:17 UTC proposal.created

[Full history](https://bounty.xe.network/log?ref=XE-16706) · [JSON](https://bounty.xe.network/v1/tickets/XE-16706) · [markdown](https://bounty.xe.network/XE-16706.md)

### 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 Denne**team2026-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.
