Bounty
XE-19608 · Bounty

[Medium] Chat read path never verifies envelope signatures: the node serving a user can forge messages from any sender

New claimed Medium web filed 2026-11-20 00:34 UTC by xe:adcb6690

Report

Title

[Medium] Chat read path never verifies envelope signatures: the node serving a user can forge messages from any sender

Summary

Chat 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:

  • client/chat.go — Client.ChatMessages returns decoded envelopes unchecked.
  • cmd/xe/chat.go — chatRead / printEnvelope renders them with no VerifyFull, no ID recompute, no signature check.
  • web/assets/chat.js — renders fetched / SSE envelopes the same way.

The 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.

Impact / worst case

  • 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.
  • The forgery needs no key material: an envelope with a correct ID and a 64-zero-byte signature is accepted by the read path.
  • Signature verification exists in the codebase and works — it is simply never invoked where the user actually reads.

Root cause

  • client/chat.go (Client.ChatMessages): decoded envelopes are returned to callers without VerifyFull or any authenticity check.
  • cmd/xe/chat.go (chatRead, printEnvelope): renders whatever the client returns.
  • web/assets/chat.js: same on the web surface.
  • Contrast: the node-side account_chat storage path does verify envelopes before storing them — the read path was never given the same gate.

Reproduction (PoC, local — deterministic)

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.

Run (from a repo copy, PoC file copied into cmd/xe/):

go test ./cmd/xe/ -run 'TestNodeChatClientForgery' -v -count=1

Dedup check (checked against 877 unique public tickets, 19 Nov 2026)

Closest:

  • XE-1254 — DAO inbox publishes unverified envelopes (server-side publishing surface; different file, different attacker, different effect).
  • XE-2345 — node account_chat storage binding (envelopes there are verified before storage).
  • XE-0448 — rendering of genuine signed messages.
  • XE-0059 / XE-2879 — read-authorisation proofs, not envelope authenticity.

Stated 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.

Suggested fix

  • Verify envelopes on the client read path: VerifyFull + ID recompute in Client.ChatMessages, and the equivalent check in the web UI before rendering.
  • Drop (or visibly flag) envelopes that fail verification instead of rendering them as genuine.

Attachments to include on filing

  • node_chat_client_forgery_poc_test.go (test TestNodeChatClientForgery; copy into cmd/xe/).

Payout

Payout address: 1338a9d472828e5b8cab097cb77979cf6062fdb5678ad1f759a48ddc8aad7189

Thread

Nothing public yet.