XE-10208 · Bounty
Silent Protocol Failure: Client SDK methods omit HTTP status validation masking server errors as empty state
Closed · duplicate
—
web
filed 2026-11-12 10:53 UTC
by xe:e4cd6974
Report
Vulnerability Summary
In client/client.go:35-152, the official Go client SDK provides wrapper methods for communicating with XE network nodes. Multiple key methods (GetChain, GetBalances, GetPending, GetProviders, GetLeases) ignore resp.StatusCode completely:
func (c *Client) GetChain(addr string) ([]*core.Block, error) {
...
resp, err := http.Get(url)
if err != nil {
return nil, err
}
var result struct {
Blocks []*core.Block `json:"blocks"`
Total int `json:"total"`
}
err = json.NewDecoder(resp.Body).Decode(&result)
_ = resp.Body.Close()
if err != nil {
return nil, err
}
all = append(all, result.Blocks...)
...
}
func (c *Client) GetBalances(addr string) (map[string]uint64, error) {
resp, err := http.Get(fmt.Sprintf("%s/accounts/%s/balance", c.BaseURL, addr))
if err != nil {
return nil, err
}
defer func() { _ = resp.Body.Close() }()
var result struct {
Balances map[string]uint64 `json:"balances"`
}
_ = json.NewDecoder(resp.Body).Decode(&result)
if result.Balances == nil {
return map[string]uint64{}, nil
}
return result.Balances, nil
}
Critical architectural flaw:
- Status Code Omission: When the node returns non-200 responses (e.g.
500 Internal Server Error,502 Bad Gateway,503 Service Unavailable, or429 Too Many Requests),resp.StatusCodeis never checked. - Silent Failure as Empty State: The JSON error body (e.g.
{"error":"..."}) fails to unmarshal into the expected payload struct fields (result.Blocks,result.Balances,result.Pending), resulting in empty or zero-value structs witherr == nil. - Downstream CLI & Application Misbehavior:
- In
cmd/xe/main.go:699-703(cmdSend), an upstream 503 or 429 response causesGetBalancesto returnmap[string]uint64{}, misleading the user with a false "insufficient balance" error. - In
cmd/xe/main.go:740-745(cmdReceive), a node error duringGetPendingcauses the CLI to report "No pending sends to receive", masking uncollected funds. - In
GetChain, an HTTP 404 or 500 response returns an empty slice with no error, causing downstream callers to mistakenly assume the account is uninitialized and forge a new genesis block withPrevious = "0".
- In
Proposed Remediation
In client/client.go, enforce status checks across all HTTP request methods before unmarshaling:
if resp.StatusCode != http.StatusOK {
body, _ := io.ReadAll(resp.Body)
return nil, fmt.Errorf("HTTP %d: %s", resp.StatusCode, strings.TrimSpace(string(body)))
}
Thread
Joseph Denneteam2026-11-20 00:33 UTCdesk
Thanks. This is the same finding as https://bounty.xe.network/XE-0121, 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-10208 and says what differs; it is read like any other.