<!-- XE-16848 · [Medium] Go client SDK reads unbounded response bodies — a malicious node OOMs the client with one response · testnet -->
*Markdown view of <https://bounty.xe.network/XE-16848>. The page is the record; this is the same page for reading.*

XE-16848 · Bounty

# \[Medium\] Go client SDK reads unbounded response bodies — a malicious node OOMs the client with one response

Closed · duplicate
—claimed Medium
[xe#674](https://github.com/xeprotocol/xe/issues/674)
filed 2026-11-17 06:39 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

- [770200](https://bounty.xe.network/log/770200) 2026-11-22 23:26 UTC reply.mirror\_failed
- [769828](https://bounty.xe.network/log/769828) 2026-11-22 23:26 UTC proposal.adopted
- [769827](https://bounty.xe.network/log/769827) 2026-11-22 23:26 UTC reply.sent
- [769826](https://bounty.xe.network/log/769826) 2026-11-22 23:26 UTC proposal.adopted
- [769825](https://bounty.xe.network/log/769825) 2026-11-22 23:26 UTC ticket.status new → closed
- [768765](https://bounty.xe.network/log/768765) 2026-11-22 23:25 UTC proposal.adopted
- [768764](https://bounty.xe.network/log/768764) 2026-11-22 23:25 UTC ticket.facts area
- [768763](https://bounty.xe.network/log/768763) 2026-11-22 23:25 UTC proposal.adopted
- [768762](https://bounty.xe.network/log/768762) 2026-11-22 23:25 UTC ticket.facts
- [768761](https://bounty.xe.network/log/768761) 2026-11-22 23:25 UTC proposal.adopted
- [768760](https://bounty.xe.network/log/768760) 2026-11-22 23:25 UTC ticket.facts
- [766680](https://bounty.xe.network/log/766680) 2026-11-22 23:18 UTC note.added

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

### Report

## Summary

The Go client SDK decodes response bodies with no size limit. A malicious node can OOM the client (CLI or automation) with a single response: a \~200MB JSON array made `GetLeases` allocate 717 MB, and a 200MB error body made `SubmitBlock` build a 209,715,210-character error string (\+629 MB heap). No loop is needed — one response suffices.

## Root cause

`json.NewDecoder(resp.Body).Decode(...)` with no `io.LimitReader` in `GetBalances`/`GetPending`/`GetProviders`/`GetLeases`/`getJSON`/`GetChain`/`GetReputation`/`GetVM` (`client/client.go`) and `ChatMessages` via `do()` (`client/chat.go`); `io.ReadAll(resp.Body)` with no limit on the error paths in `SubmitBlock` (`client/client.go`) and `do()` (`client/chat.go`). Additional instance: `cmdLeaseRenew` (`cmd/xe/main.go:1138`, `io.ReadAll`). No `LimitReader`/`MaxBytesReader` exists anywhere in `client/`.

## Verification

Executed PoC against a fake node:

- Fake node returns a \~200MB JSON array → `GetLeases` decoded all 200,000 entries, heap grew **717 MB** (0 → 717 MB), `err=nil`.
- Fake node returns a 200MB error body → `SubmitBlock` error string is **209,715,210 chars**, heap \+629 MB.

## Note on related reports

Searched `response size LimitReader MaxBytesReader client` — 0 hits. Distinct from #647 (`GetChain` infinite loop on a lying `Total`) — that needs a loop; this needs one response.

## Suggested fix

Wrap response bodies in `io.LimitReader` (e.g. a few MB, generous for any legitimate XE response) before decoding, and cap the error-body read in `SubmitBlock`/`do()`.

### 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-16848 and says what differs; it is read like any other.
