{"id":"XE-16981","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"692","source_url":"https://github.com/xeprotocol/xe/issues/692","reporter_id":2920,"title":"[Low] xe lease renew nil-pointer panic on malformed XE_NODE","area":"sdk-docs-web","claimed_tier":null,"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-17T08:13:51.970288+00:00","updated_at":"2026-11-22T23:26:11.537551+00:00","source_created_at":"2026-11-17T08:11:48+00:00","told_at":"2026-11-22T23:26:11.571783+00:00","status_changed_at":"2026-11-22T23:26:11.548900+00:00","url":"https://bounty.xe.network/XE-16981","body":"## Summary\n\n`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.\n\n## Root Cause\n\n`cmd/xe/main.go:1131-1132`:\n\n```go\nreq, _ := http.NewRequest(\"POST\", nodeURL()+\"/lease/\"+hash+\"/renew\", bytes.NewReader(body))\nreq.Header.Set(\"Content-Type\", \"application/json\")\n```\n\n`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/`.\n\n## Verification\n\nExecuted:\n\n```\n$ XE_API_ADMIN_TOKEN=x XE_NODE=\"://bad\" xe lease renew <64-hex> 60\npanic: runtime error: invalid memory address or nil pointer dereference\ngoroutine 1 [running]:\nmain.cmdLeaseRenew(...)\n\t/home/hatch/workspace/xe/xe/cmd/xe/main.go:1132\n```\n\n## Note on related reports\n\nSearched \"lease renew panic nil request\" — #496 (node-side post-commit gossip failure) and #215 are different mechanisms.\n\n## Suggested fix\n\nCheck the `NewRequest` error and fail with a clean message (`fatal(\"invalid XE_NODE: %v\", err)`).\n","patch_refs":[],"thread":[{"id":18795,"source":"desk","source_ref":"reply:16472","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-16981 and says what differs; it is read like any other.","created_at":"2026-11-22T23:26:11.537551+00:00"}]}