[Medium] cmd/xe chat: signed chat messages render ANSI/OSC terminal control sequences verbatim — screen-clear + OSC-8 phishing inside an authenticated session
Report
Suggested severity: Medium
Duplicate check: swept the full live tracker. #50 is the SSE-overflow vector (and explicitly refutes chat starvation via SSE); #10's memo finding is Unicode C1/Bidi in transaction memos. No issue covers ANSI/OSC terminal control sequences rendered by the chat CLI.
Reviewed at commit 02e9641b0ac64437f57e09d63301f88cce61a802.
Summary
Signed chat messages are rendered to the terminal verbatim, including ANSI/OSC control sequences. One signed, PoW-solved envelope can clear the victim's screen and render attacker-controlled text as a clickable hyperlink — a phishing primitive delivered inside an already-authenticated session.
Evidence
cmd/xe/chat.go:230:fmt.Fprintf(w, "%s %s -> %s %s\n", ts, env.From, env.To, env.Message)— no sanitization.chat/envelope.go:84-109(VerifyFull): validates signature, PoW and freshness — everything about authenticity, nothing about content.chat/chat.goStore: keepsMessagebyte-for-byte.
Observed (PoC against a copy of the repo):
POC1: signed envelope with terminal escapes PASSES VerifyFull
POC1: rendered line: "2026-11-04T08:03:27Z fed11e56… -> victim-address \x1b[2J\x1b[H\x1b]8;;http://evil.example\aIMPORTANT: re-enter your wallet phrase at http://evil.example\x1b]8;;\a\a\n"
Attack
Victim registers in the directory; attacker sends one envelope whose Message is \x1b[2J\x1b[H + OSC-8 hyperlink + bell. Victim runs xe chat read (or --follow): screen clears, attacker text renders as a clickable link. Other escapes rewrite the scrollback/status line for persistent fake prompts. The chat read path already requires an ownership proof, so the victim is by definition logged in when the payload fires.
Impact
One signed message phishes or manipulates any user who reads chat; no interaction beyond xe chat read.
Fix direction: strip C0/C1 control sequences and OSC/CSI escapes (except newline/tab) at render time in cmd/xe/chat.go, or reject envelopes whose message contains them.
Thread
Thanks. This is the same finding as https://bounty.xe.network/XE-0409, 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, reply with what differs and we will look again.