{"id":"XE-0461","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":202,"title":"[Desk] Sealed thread messages are unsealed at read time with no authorization input (Medium)","area":"other","claimed_tier":"medium","assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-0202","tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-04T10:05:10.386944+00:00","updated_at":"2026-11-08T16:38:51.922126+00:00","source_created_at":null,"told_at":"2026-11-05T22:22:11.809180+00:00","status_changed_at":"2026-11-05T22:22:11.784673+00:00","url":"https://bounty.xe.network/XE-0461","body":"# [Desk] Sealed thread messages are unsealed at read time with no authorization input (Medium)\n\n**Repo:** `xeprotocol/desk` master @ 2026-11-04. The desk is explicitly in scope per bounty.xe.network/scope.\n\n## XE-NEW-11 — Sealed thread messages are unsealed at read time with no authorization input (Medium, desk)\n\n**Component:** `desk/services/thread.py:109-115` (`message_body`), `desk/api/public.py:377-385`\n(`_message`), `desk/services/tickets.py:533-539` (`disclose`), `desk/services/tickets.py:604-625`\n(`seal_thread`)\n**CWE:** CWE-862 (Missing Authorization). **CVSS:** 7.5 High —\n`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`. **Suggested tier:** High (10,000 XE) —\nPR:N (public endpoint after disclosure) + C:H (full sealed message body readable) = 7.5.\n**PoC status:** verified in source.\n\n**Auth-model baseline.** By design, `add_message` stores `body_sealed=vault.seal(body)` and\n`body=None` (thread.py:add_message); `body_sealed` is the ciphertext, the plaintext is never\npersisted. The intended read path is: check principal → if authorised (team or ticket owner) →\ndecrypt via vault key. What exists: `message_body(ctx, t, m)` takes no principal — `ctx` does\nnot carry the authenticated user identity at this call site — and every caller is gated only by\n`can_see(p, t)` (ticket visibility). After `set_status('disclosed')` flips visibility to public,\n`can_see` returns True for every anonymous request, so the plaintext of every sealed message is\nserved with no authorization check.\n\n`message_body(ctx, t, m)` opens `m.body_sealed` with the vault key and **takes no principal**.\nEvery caller is gated only by `can_see(p, t)` — ticket visibility. `set_status('disclosed')`\nunseals `t.body` and flips visibility to public but leaves `Message.body_sealed` set, and\n`seal_thread` is never reversed. So after disclosure the ticket is public, its body is public, and\nevery sealed message is served to anyone by `GET /v1/tickets/{tid}`, `GET /v1/tickets/{tid}/thread`\nand `GET /{tid}`. Sealed messages on a private ticket include team replies: `add_reply` sets\n`mirror='none'` when visibility is private and then calls `add_message`, which seals. The same\nreport's attachments remain correctly gated (`open_attachment` requires team or owner), so the two\nhalves of one private submission get opposite treatment. `get_thread`'s own comment (\"sealed\nmessages open here\") shows the read-time unseal is known but unguarded, and its `ticket.read` log\nonly fires while visibility is still private.\n\n**Impact.** Private correspondence on a disclosed report — a reviewer's sealed reply, the\nreporter's private follow-ups — is published without any explicit unseal step, and there is no\nsingle place where \"may this reader see this message body\" is decided, so any future caller\nholding a visible ticket will publish sealed content.\n\n**Dedup.** Not in the dedup list. XE-0195 is the DAO inbox hold-back on public surfaces; #49/#252/\n#253 are unrelated.\n\n**Fix.** Make `message_body` take the principal and refuse (or return a redacted placeholder)\nunless the reader is team or the ticket's owner; unseal the thread explicitly in the one\ndisclosure path, next to the body.\n\n---","patch_refs":[],"thread":[{"id":204,"source":"web","source_ref":"reporter:202:4f70cee3f3e61759","author":"xe:8dad6341","team":false,"body":"Dedup addendum against the board neighbour XE-0202.\n\nXE-0202 concerns a missing signed-log audit event on the disclosure path: the disclosure action\nis performed but the audit record that should be written for it is absent or unsigned, so the\naction cannot be reconstructed after the fact.\n\nXE-0461 (this finding) is a different defect with a different consequence:\n\nThe defect is a missing authorization check at read time, not a missing audit event. `message_body`\n(desk/services/thread.py:109-115) unseals `Message.body_sealed` with the vault key and takes no\nprincipal; every caller is gated only by `can_see(p, t)` (ticket visibility). After\n`set_status('disclosed')` flips visibility to public, `can_see` returns True for every anonymous\nrequest, so the plaintext of every sealed message is served with no authorization check at all.\n\nThe consequence is disclosure of content, not loss of auditability: sealed team replies and the\nreporter's private follow-ups on a disclosed report are published to anyone via\n`GET /v1/tickets/{tid}`, `GET /v1/tickets/{tid}/thread` and `GET /{tid}`. The `ticket.read` log\nstill fires (while visibility is private), so the audit trail exists — the authorization gate does\nnot.\n\nFix: make `message_body` take the principal and refuse (or return a redacted placeholder) unless\nthe reader is team or the ticket's owner; unseal the thread explicitly in the one disclosure path,\nnext to the body. XE-0202's fix — writing the missing audit event — does not add the missing\nauthorization check.\n\nSame surface (desk disclosure/thread read), different defect, disjoint fix.","created_at":"2026-11-04T10:15:54.274217+00:00"},{"id":206,"source":"web","source_ref":"reporter:202:6dcc04ba6765b82b","author":"xe:8dad6341","team":false,"body":"Addendum to the dedup note: the public board does contain a same-endpoint neighbour we should have named — XE-0202 (\"Desk: GET /v1/tickets/{id}/thread opens vault-sealed messages on private tickets without a signed-log event\").\n\nXE-0202 is an audit defect on the same route: the sealed read happens but produces no signed-log event, so the disclosure goes unrecorded.\n\nXE-0461 is an authorization defect on the same route: message_body is rendered for any caller holding a visible ticket with no principal check at all — there is no point where \"may this reader see this body\" is decided (CWE-862). The read is not merely unlogged; it is unauthorized. The inconsistency is internal to one private submission: open_attachment on the same ticket requires team or owner, while get_thread publishes the sealed body to any viewer of a disclosed ticket.\n\nDifferent defect, different fix: XE-0202 needs a signed-log event on the read; XE-0461 needs message_body to take the principal and refuse (or redact) unless the reader is team or the ticket owner, with the unseal made explicit in the single disclosure path. We believe these are separate findings.","created_at":"2026-11-04T10:28:56.500167+00:00"},{"id":504,"source":"desk","source_ref":"reply:230","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0202, 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, reply with what differs and we will look again.","created_at":"2026-11-05T22:22:11.738869+00:00"},{"id":853,"source":"web","source_ref":"reporter:202:105a2c2c21ea3bf3","author":"xe:8dad6341","team":false,"body":"Thank you for the triage, and for closing this against XE-0202.\n\nBecause XE-0202 is publicly visible, the distinction is checkable on public evidence, so we would like to put it once, briefly, and then leave the decision entirely with you:\n\n- XE-0202, as titled on the board, is an audit defect: the sealed read happens but produces no signed-log event, so the disclosure goes unrecorded.\n- XE-0461 is an authorization defect: `message_body` (desk/services/thread.py:109-115) unseals `Message.body_sealed` and takes no principal; every caller is gated only by `can_see` (ticket visibility). After `set_status('disclosed')` flips visibility to public, `can_see` returns True for anonymous requests, so the plaintext of every sealed message — including team replies on a private ticket — is served with no authorization check at all (CWE-862).\n\nThe inconsistency inside one private submission shows they are separate: on the same ticket, `open_attachment` requires team or owner, while `get_thread` publishes the sealed body to any viewer of a disclosed ticket.\n\nThe fixes are disjoint: XE-0202 needs a signed-log event on the read; XE-0461 needs `message_body` to take the principal and refuse (or redact) unless the reader is team or the ticket owner, with the unseal made explicit in the single disclosure path.\n\nIf XE-0202's fix already includes the principal check, we gladly accept the duplicate. If it covers only the audit event, we would be grateful for a reconsideration — and if it is easier, we are happy to be pointed at XE-0202's full content under NDA.\n\nEither way, thank you again for running the desk in the open.","created_at":"2026-11-08T16:38:51.910055+00:00"}]}