{"id":"XE-19608","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":957,"title":"[Medium] Chat read path never verifies envelope signatures: the node serving a user can forge messages from any sender","area":"node-api","claimed_tier":"medium","assessed_tier":null,"verdict":null,"duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":null,"status":"new","closed_reason":null,"github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-20T00:34:50.073237+00:00","updated_at":"2026-11-20T00:34:50.073237+00:00","source_created_at":null,"told_at":null,"status_changed_at":null,"url":"https://bounty.xe.network/XE-19608","body":"## Title\r\n\r\n[Medium] Chat read path never verifies envelope signatures: the node serving a user can forge messages from any sender\r\n\r\n## Summary\r\n\r\nChat envelopes are signed so that relays and serving nodes do not need to be trusted — but only the serving node's *storage* path was ever gated on verification. The consumer read path never checks anything:\r\n\r\n- `client/chat.go` — `Client.ChatMessages` returns decoded envelopes unchecked.\r\n- `cmd/xe/chat.go` — `chatRead` / `printEnvelope` renders them with no `VerifyFull`, no ID recompute, no signature check.\r\n- `web/assets/chat.js` — renders fetched / SSE envelopes the same way.\r\n\r\nThe CLI's default node is a **remote third-party node** (`cmd/xe/main.go` `nodeURL()` defaults to `https://ldn.core.test.network`), so the node a user queries — or anything answering for it — can fabricate a message from any sender, and every client surface will present it as genuine.\r\n\r\n## Impact / worst case\r\n\r\n- Impersonation / phishing-grade forgery: a malicious or compromised serving node can inject messages that appear to come from any account — e.g. a fake \"support\" or counterparty message (\"reply with your recovery phrase to keep your account\") rendered as authentic by the CLI and the web UI.\r\n- The forgery needs no key material: an envelope with a correct ID and a 64-zero-byte signature is accepted by the read path.\r\n- Signature verification exists in the codebase and works — it is simply never invoked where the user actually reads.\r\n\r\n## Root cause\r\n\r\n- `client/chat.go` (`Client.ChatMessages`): decoded envelopes are returned to callers without `VerifyFull` or any authenticity check.\r\n- `cmd/xe/chat.go` (`chatRead`, `printEnvelope`): renders whatever the client returns.\r\n- `web/assets/chat.js`: same on the web surface.\r\n- Contrast: the node-side `account_chat` storage path *does* verify envelopes before storing them — the read path was never given the same gate.\r\n\r\n## Reproduction (PoC, local — deterministic)\r\n\r\n`TestNodeChatClientForgery` — an in-process node serves one envelope with a correct ID but a 64-zero-byte signature. `chatRead` printed it as a genuine message (\"…urgent: reply with your recovery phrase to keep your account\"), while the control `forged.VerifyFull(0)` correctly rejected it. Test asserts correct behaviour, so **FAIL = bug reproduced**; control PASS. Re-verified 19 Nov 2026.\r\n\r\nRun (from a repo copy, PoC file copied into `cmd/xe/`):\r\n\r\n```\r\ngo test ./cmd/xe/ -run 'TestNodeChatClientForgery' -v -count=1\r\n```\r\n\r\n## Dedup check (checked against 877 unique public tickets, 19 Nov 2026)\r\n\r\nClosest:\r\n\r\n- XE-1254 — DAO inbox publishes unverified envelopes (server-side *publishing* surface; different file, different attacker, different effect).\r\n- XE-2345 — node `account_chat` storage binding (envelopes there *are* verified before storage).\r\n- XE-0448 — rendering of genuine signed messages.\r\n- XE-0059 / XE-2879 — read-*authorisation* proofs, not envelope authenticity.\r\n\r\nStated plainly: XE-1254 and XE-0001's \"directory/chat P2P poisoning\" phrase sit in the same problem space. But chat tickets have historically been triaged per surface (XE-1254 / XE-2345 / XE-2879 / XE-3519 coexist as separate tickets), and this finding's observable effect (per-user client rendering of relayed forgeries) and fix (verify on the client read path) differ from every closest ticket.\r\n\r\n## Suggested fix\r\n\r\n- Verify envelopes on the client read path: `VerifyFull` + ID recompute in `Client.ChatMessages`, and the equivalent check in the web UI before rendering.\r\n- Drop (or visibly flag) envelopes that fail verification instead of rendering them as genuine.\r\n\r\n## Attachments to include on filing\r\n\r\n- `node_chat_client_forgery_poc_test.go` (test `TestNodeChatClientForgery`; copy into `cmd/xe/`).\r\n\r\n## Payout\r\n\r\nPayout address: 1338a9d472828e5b8cab097cb77979cf6062fdb5678ad1f759a48ddc8aad7189","patch_refs":[],"thread":[]}