Bounty
XE-16981 · Bounty

[Low] xe lease renew nil-pointer panic on malformed XE_NODE

Closed · duplicate — xe#692 filed 2026-11-17 08:11 UTC by kecedanzz77-bit

Report

Summary

xe lease renew panics with a nil-pointer dereference when XE_NODE is malformed: http.NewRequest's error is ignored and the nil request is dereferenced on the next line. Self-DoS via the operator's own env var, but a crash + stack trace instead of a clean error.

Root Cause

cmd/xe/main.go:1131-1132:

req, _ := http.NewRequest("POST", nodeURL()+"/lease/"+hash+"/renew", bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")

NewRequest returns a nil request on a malformed URL; the error is discarded with _, and req.Header.Set panics. Requires XE_API_ADMIN_TOKEN set to reach (:1126-1129). This is the only site with this pattern — client/chat.go:81 checks the error, and a grep confirms no other ignored NewRequest in cmd//client//api//node/.

Verification

Executed:

$ XE_API_ADMIN_TOKEN=x XE_NODE="://bad" xe lease renew <64-hex> 60
panic: runtime error: invalid memory address or nil pointer dereference
goroutine 1 [running]:
main.cmdLeaseRenew(...)
	/home/hatch/workspace/xe/xe/cmd/xe/main.go:1132

Note on related reports

Searched "lease renew panic nil request" — #496 (node-side post-commit gossip failure) and #215 are different mechanisms.

Suggested fix

Check the NewRequest error and fail with a clean message (fatal("invalid XE_NODE: %v", err)).

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