Bounty
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 filed 2026-11-17 06:39 UTC by kecedanzz77-bit

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