{"id":"XE-16848","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"674","source_url":"https://github.com/xeprotocol/xe/issues/674","reporter_id":2920,"title":"[Medium] Go client SDK reads unbounded response bodies — a malicious node OOMs the client with one response","area":"sdk-docs-web","claimed_tier":"medium","assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-17T06:39:33.786498+00:00","updated_at":"2026-11-22T23:26:11.759744+00:00","source_created_at":"2026-11-17T06:39:25+00:00","told_at":"2026-11-22T23:26:11.786612+00:00","status_changed_at":"2026-11-22T23:26:11.765889+00:00","url":"https://bounty.xe.network/XE-16848","body":"## Summary\n\nThe 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.\n\n## Root cause\n\n`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/`.\n\n## Verification\n\nExecuted PoC against a fake node:\n- Fake node returns a ~200MB JSON array → `GetLeases` decoded all 200,000 entries, heap grew **717 MB** (0 → 717 MB), `err=nil`.\n- Fake node returns a 200MB error body → `SubmitBlock` error string is **209,715,210 chars**, heap +629 MB.\n\n## Note on related reports\n\nSearched `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.\n\n## Suggested fix\n\nWrap 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()`.","patch_refs":[],"thread":[{"id":18798,"source":"desk","source_ref":"reply:16475","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-16848 and says what differs; it is read like any other.","created_at":"2026-11-22T23:26:11.759744+00:00"}]}