{"id":"XE-0202","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":62,"title":"Desk: GET /v1/tickets/{id}/thread opens vault-sealed messages on private tickets without a signed-log event","area":"other","claimed_tier":"medium","assessed_tier":"minor","verdict":"valid","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"awarded","closed_reason":null,"github_state":"","disclosed_at":"2026-11-04T03:41:14.224031+00:00","award_xe":100000000,"award_approved":true,"paid_ref":"","created_at":"2026-11-02T05:58:37.422332+00:00","updated_at":"2026-11-04T03:41:17.490161+00:00","source_created_at":null,"told_at":"2026-11-04T03:34:06.848732+00:00","status_changed_at":"2026-11-04T03:41:17.495399+00:00","url":"https://bounty.xe.network/XE-0202","body":"**Claim**\r\nThe desk's vault module states its own security invariant: the plaintext of sealed content \"exists only in the response to a reader the authorisation layer has already admitted, **and that read is an event in the log**\" (`desk/vault.py`). The attachment path repeats why: opening a sealed attachment is logged so that \"'who has seen this exploit' has an answer\" (`desk/services/reporters.py`). One read path breaks the invariant: `GET /v1/tickets/{tid}/thread` (`desk/api/public.py`, `get_thread()`) returns the vault-sealed thread messages of a private ticket in plaintext to every admitted reader — an agent token holding `read:private`, a team user, or the owning reporter — and appends **no event at all** to the signed log. Every sibling read path logs: the ticket GET and the HTML ticket page append `ticket.read`, and the attachment download appends `attachment.read`. The thread route silently defeats the audit guarantee on the desk's most sensitive content class: the sealed thread of a private (Critical/Severe) report, where reporter follow-ups, PoC links and extra evidence live.\r\n\r\n**Code**\r\n- `desk/api/public.py:164-166` — `get_thread()`: authorizes via `tsvc.get_for(...)`, then serializes messages via `_message(...)`; no `ctx.events.append(...)` anywhere in the handler. The only `events.append` in the whole file is in `get_ticket()` (line 151, `ticket.read` for private tickets).\r\n- `desk/api/public.py:356` → `desk/services/thread.py:109-115` — `_message()` calls `message_body()`, which opens sealed text via `ctx.vault.open_text(m.body_sealed)` for messages sealed by `add_message()` on private tickets.\r\n- The invariant as the codebase states it: `desk/vault.py:1-6` (\"that read is an event in the log\"); `desk/services/tickets.py:123` (`body_for()`: \"Callers log the read.\"); `desk/services/reporters.py:379` (`open_attachment()`: logged, so \"'who has seen this exploit' has an answer\").\r\n- The HTML page honours it too: `desk/ui.py:546` appends `ticket.read`.\r\n\r\n**Reproduced?**\r\nYes — executed end-to-end against a locally running desk instance (fresh local Postgres, `repos/desk @ 32fd760`, no live traffic), with a seeded private ticket carrying a vault-sealed body, one vault-sealed thread message and one sealed attachment. Method: snapshot the signed-log head, perform the read, diff the log.\r\n\r\n| Read path | Caller | Sealed content served | New log events |\r\n|---|---|---|---|\r\n| `GET /v1/tickets/{id}` (control) | team admin | yes (body) | `ticket.read` |\r\n| `GET /v1/reporter/tickets/{id}/attachments/1` (control) | reporter-owner | yes | `attachment.read` |\r\n| `GET /{id}` HTML page (control) | team admin | yes (body) | `ticket.read` |\r\n| **`GET /v1/tickets/{id}/thread`** | **agent token `read:private`** | **yes (message)** | **none** |\r\n| **`GET /v1/tickets/{id}/thread`** | **team admin** | **yes (message)** | **none** |\r\n| **`GET /v1/tickets/{id}/thread`** | **reporter-owner** | **yes (message)** | **none** |\r\n\r\nNote the second control: even the reporter-owner's own attachment read IS logged by the desk — the rule is that every opening is logged, whoever asks. The thread route is the lone exception. The signed chain itself remains intact (`GET /v1/log/verify` → `{\"ok\": true, ...}`): the gap is the completeness of the audit trail, not chain integrity — an audit that counts `ticket.read` events systematically under-reports openings of sealed thread content, and after the fact there is no way to answer \"who has seen this exploit\" for thread messages.\r\n\r\nPoC attached: `poc_sh1_standalone.py` (single file, self-bootstrapping; 10/10 checks PASS), with a captured transcript of a fresh re-run attached as `SH1-run-evidence.md` (identical outcome; fixture ids are instance-local).\r\nIndependent verification: code-level confirmation from a clean checkout (all load-bearing lines verified verbatim) — AiSOC lane, 2026-11-02.\r\n\r\n**Impact**\r\nPrivate tickets are the sealed Critical/Severe channel. Their thread messages are vault-sealed precisely because they carry exploit detail. The desk's public security story for that channel is that sealed content is never opened without a signed-log record; the `/thread` route defeats it silently for the three caller classes that matter most:\r\n- **Agent tokens with `read:private`** — the scope issued to automated agents, i.e. machine principals whose reads the audit log exists to watch — can read all sealed thread content on any private ticket and leave zero trace.\r\n- **Team users** — an insider opening sealed material is likewise invisible to the log that `/v1/log/verify` attests.\r\n- **The owning reporter** — included for completeness; the desk logs even their attachment reads, so this route is inconsistent with the desk's own rule, though it is the least sensitive of the three.\r\n\r\nBounded, honestly: authorization is **not** bypassed — only readers already admitted to the ticket can use the route (a non-owner gets 404); the ticket *body* is not served by this route (thread messages only); no other users' data is reachable. This is an audit-trail/integrity defect on the most sensitive content class, not a confidentiality break against outsiders. Verified against the in-scope shipped source (`repos/desk @ 32fd760`); a live test was not performed, as it would require owning a private ticket with sealed thread content on the live desk.\r\n\r\n**Already known?**\r\nNo. Deduped 2026-11-02 against all 111 desk tickets (titles and full bodies) and the 135 GitHub issues: no finding covers vault-open logging, `ticket.read` coverage, or the thread route. The nearest neighbour, XE-0051, concerns missing security headers on the xe/web wallet origin — a different application. Desk-side authorization and log coverage had no prior tickets (the desk-adjacent findings on record are dao-harness items: XE-0032/0033/0034/0062/0080).\r\n\r\n**Fix**\r\nIn `get_thread()` (`desk/api/public.py`), mirror `get_ticket()`: when `t.visibility == \"private\"`, append `ticket.read` (public=False, ref=t.id) and commit before returning. Better, make the logging structural — a single helper every sealed-read path must call (e.g. have `message_body()`/`body_for()` take the principal and log via the events service) — so a future route cannot forget it again.\r\n\r\n**Award line:** Payout to the bound XE address on this ticket if accepted. Self-assessed Minor–Medium; team's discretion acknowledged.","patch_refs":[{"id":250,"repo":"xeprotocol/desk","kind":"commit","ref":"1fac5b2197cebd63535f5537d75537c141d0d4aa","title":"","url":"https://github.com/xeprotocol/desk/commit/1fac5b2197cebd63535f5537d75537c141d0d4aa","note":"","state":"","author":"","added_by":"token:6","created_at":"2026-11-04T03:18:37.675726+00:00"}],"thread":[{"id":101,"source":"web","source_ref":"reporter:62:c1e37a59e7b68803","author":"wanglimaven","team":false,"body":"# Run evidence — captured transcript (fresh re-run, 2026-11-02)\n\nWhat this is: the verbatim check output of `poc_sh1_standalone.py` run\nagainst a fresh, self-bootstrapped local desk instance (source:\n`repos/desk` @ 32fd760, embedded PostgreSQL, no live traffic). The script\nseeds one private ticket (XE-0001 on the throwaway instance) with a\nvault-sealed body, one vault-sealed thread message and one sealed\nattachment, then probes every read path and diffs the signed log.\nInstance-local ids/markers are fixture values, not live data.\n\n```\n[setup] fixture seeded: private ticket XE-0001 (sealed body + sealed message + attachment id 1)\nPASS C1 ticket GET (admin): sealed body served + ticket.read logged :: new_events=['ticket.read']\nPASS C2 attachment GET (reporter-owner): sealed bytes served + attachment.read logged :: new_events=['attachment.read']\nPASS C3 HTML ticket page (admin): sealed body served + ticket.read logged :: new_events=['ticket.read']\nPASS T1a thread GET (admin): sealed message served :: status=200\nPASS T1b thread GET (admin): ZERO new log events (no ticket.read) :: new_events=[]\nPASS T2a thread GET (token read:private): sealed message served :: status=200\nPASS T2b thread GET (token read:private): ZERO new log events (no ticket.read) :: new_events=[]\nPASS T3a thread GET (reporter-owner): sealed message served :: status=200\nPASS T3b thread GET (reporter-owner): ZERO new log events (no ticket.read) :: new_events=[]\nPASS V1 signed log chain verifies ok (GET /v1/log/verify) :: status=200 body={\"ok\":true,\"count\":6,...}\n== 10/10 checks passed ==\n== VERDICT: BUG REPRODUCED — /thread opens vault-sealed messages with no signed-log event, while every sibling read path logs ==\n```\n\nReading of the result:\n- Controls C1–C3: the ticket GET, the attachment download and the HTML\n  ticket page each serve sealed content AND append their read event\n  (`ticket.read` / `attachment.read`) — the desk's stated invariant\n  working as designed.\n- Tests T1–T3: the thread route serves the sealed message plaintext to\n  all three admitted caller classes (team admin, `read:private` agent\n  token, owning reporter) and appends **zero** events in every case.\n- V1: the signed chain still verifies — the defect is completeness of\n  the audit trail, not chain integrity.\n\nHarness deviations (also documented in the PoC header; none touches\ndesk application code): the embedded PostgreSQL has no pgvector, so the\n`CREATE EXTENSION vector` line of migration 0001 is commented out in\nthe throwaway copy (no desk model uses a vector type); fixtures are\nseeded through the desk's own service layer; the instance is left in\nplace after the run for inspection (uvicorn.log, results.json).\nThis transcript is from an independent re-run of the exact attached\nPoC; the builder's first run produced the identical 10/10 outcome.","created_at":"2026-11-02T05:59:08.106158+00:00"},{"id":152,"source":"desk","source_ref":"reply:29","author":"Joseph Denne","team":true,"body":"Thank you for this report. We have confirmed it against the desk source and the fix is committed in xeprotocol/desk@1fac5b2; it reaches bounty.xe.network with the next deploy. The team's assessment is Minor. The desk itself is in scope and this is treated like any other accepted finding.","created_at":"2026-11-04T03:34:06.843870+00:00"}]}