{"id":"XE-19597","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":2799,"title":"Email magic link login CSRF: GET /v1/reporter/auth/email/{token} signs a victim's browser into the attacker's reporter account (third trigger)","area":"other","claimed_tier":"minor","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:05:57.759551+00:00","updated_at":"2026-11-20T00:05:57.759551+00:00","source_created_at":null,"told_at":null,"status_changed_at":null,"url":"https://bounty.xe.network/XE-19597","body":"# Email magic link signs a victim's browser into the attacker's reporter account: `GET /v1/reporter/auth/email/{token}` never binds the sign-in to the requesting browser (login CSRF, third trigger)\r\n\r\n**Repo pin:** `xeprotocol/desk` @ `95660dfe25e6004637fc259a1c50c9e408cce5fe` (`desk/api/reporter.py`, `desk/auth.py`, `desk/services/reporters.py`).\r\n**Suggested tier:** Minor.\r\n**CWE:** CWE-352 (CSRF) — session establishment.\r\n**Payout address (XE):** `db4043dea0d12c476c2644a3df09c4ce51fa1ce04617723405916ade3fa3305f`\r\n\r\n## Summary\r\n\r\nA plain reporter sign-in magic link carries no binding to the browser that asked for it. `email_finish` never consults the requesting browser on the sign-in path, `consume_reporter_link` and `from_email` take no browser identifier at all, and the `ReporterLink` row has no browser field — while the add-address case in the very same function *does* enforce the browser. An attacker self-registers, mails themselves a sign-in link for their own address, and sends the URL to a victim; the victim clicks and any report they then file (Critical/Severe are private by default, body and attachments vault-sealed) lands on the attacker's reporter account, with the attacker's payout address.\r\n\r\nThis is the third trigger of the login-CSRF class whose first two triggers are already filed (XE-0302 / XE-0437 / XE-0656: `xe_login` + GitHub/Discord OAuth callbacks; XE-17987: OAuth callback alone). No filed ticket names the email magic link as a trigger — see \"Why this is not a duplicate\" below.\r\n\r\n## Code\r\n\r\n`desk/api/reporter.py:318-334` (`email_finish`): the `who` (requesting browser) value is consulted only inside the `if link.reporter_id:` branch — the add-address case. On the plain sign-in path (`reporter_id=None`) it is never read. `desk/auth.py:258-273` (`create_reporter_link`) stores only `token_hash / email / reporter_id / next_path / expires_at / used_at` — no browser/session/nonce field — with `MAGIC_TTL = timedelta(minutes=15)` (`auth.py:67`). `desk/auth.py:283-340` (`consume_reporter_link(db, raw)`) takes no browser/request argument. `desk/services/reporters.py:219-241` (`from_email(ctx, db, email, link_to)`) takes no browser argument; with `link_to=None` it resolves the existing reporter row for the link's email — the attacker's row.\r\n\r\nThe asymmetry is visible in the mailed text itself (`reporter.py:290-300`, `_email_link`): a signed-in asker is told \"The link only works in the signed-in browser that asked, and it never moves an existing account\", while a signed-out asker gets a bare \"Open this link within fifteen minutes to sign in\" — no browser promise, because none exists.\r\n\r\n`_sign_in` (`reporter.py:61-68`) creates a reporter session and sets the `desk_reporter` cookie on the response. The route is a top-level GET navigation, so `SameSite=Lax` does not stop the response's `Set-Cookie` from landing in the victim's browser (Lax restricts *sending* on cross-site subrequests, not *setting*).\r\n\r\n## Steps to reproduce (source-verified; live two-browser run not executed)\r\n\r\n1. Attacker self-registers as a reporter and POSTs `/v1/reporter/auth/email` with their own email address. A `ReporterLink` row (`reporter_id=None`, 15-minute TTL) is created and the raw token URL is mailed to the attacker's own mailbox.\r\n2. Attacker sends that URL to a victim (chat, email, shortened link).\r\n3. Victim clicks within 15 minutes. `GET /v1/reporter/auth/email/{token}` burns the link (single-use), resolves the attacker's reporter row via `from_email`, and `_sign_in` sets the `desk_reporter` cookie in the victim's browser. The victim's own reporter session cookie is overwritten.\r\n4. Any report the victim then files is attached to the attacker's reporter row. The attacker reads the sealed body via `GET /v1/tickets/{id}` and `/my`, and the award/paid flow pays the attacker's bound payout address.\r\n\r\nVerification performed locally against the real code at the pinned HEAD (harness, 39 checks, all passing): before the `link.reporter_id` guard, `email_finish` never references `who`; `consume_reporter_link` takes no browser/request argument; `from_email` takes no browser argument; `ReporterLink` has no browser/cookie/fingerprint column. There is no value anywhere on this path that a binding check could even read.\r\n\r\n## Impact\r\n\r\nBounded the same way XE-17987 bounds the identical impact: the victim must click the link and then file; the attacker gains attribution of future filings, not access to the victim's existing account. What is at stake is exactly what the desk exists to protect — sealed Critical/Severe reports and the payout binding — taken without touching the victim's account. This is the sharpest of the three login-CSRF triggers: unlike `xe_login` (needs a fresh Ed25519 signature per victim) or the OAuth callbacks (needs a live 5-minute provider code), the magic link is a plain bearer URL the attacker obtains from their own mailbox and can distribute arbitrarily within its 15-minute window. Hence Minor, matching XE-17987's own assessment of the identical impact (XE-0437 claimed High for the class).\r\n\r\n## Suggested fix\r\n\r\nBind the link to the requesting browser at creation — e.g. set a short-lived nonce cookie in `email_start` and require it to match at `email_finish` — or record the requesting session in the `ReporterLink` row and require it at finish. Fixing the OAuth `state` (XE-17987) or requiring a CSRF token on `xe_login` (XE-0437) leaves this path open; the fix must be implemented on the `email_finish` path itself.\r\n\r\n## Why this is not a duplicate\r\n\r\n- **XE-0302** (the original login-CSRF ticket): body is **unreadable** — the desk API returns 404 for it (private ticket), so its trigger list cannot be verified. This is a stated residual risk: if XE-0302 itself names the email link, this report is its duplicate. What can be verified is that the two tickets closed as duplicates of XE-0302 do not name it (next item).\r\n- **XE-0437 / XE-0656** (both closed as duplicates of XE-0302; bodies read, 4,202 chars each, byte-identical): name exactly **two** triggers — `xe_login` POST (`reporter.py:317-329`) and the GitHub/Discord OAuth callbacks (`reporter.py:108-158`, `:199-243`). Neither body mentions the email magic link anywhere. XE-0437's mechanism text even asserts that `email_finish` was CSRF-checked at its 2026-11-04 pin — i.e. the email path was treated as covered, and its sign-in branch was never examined.\r\n- **XE-17987** (new, untriaged, Minor; body read): re-files the **OAuth callback trigger alone** as its own ticket — the per-trigger precedent this report follows. Its evidence cites `services/reporters.py:219-241` (`from_email`) only as the *merge-direction* mitigation; it never names the email sign-in link as a trigger.\r\n- **XE-0709 / XE-0782** (magic-link single-use / sibling-burn): different mechanism — they cover concurrent consume and stale-link invalidation, not browser binding.\r\n- **XE-11619 / XE-5437** (unthrottled email endpoint / mail trigger): different mechanism — mail flooding from the unauthenticated endpoint, not login CSRF via the link.\r\n- Distinct code location (`email_finish` / `consume_reporter_link`, not `xe_login` / OAuth callbacks), distinct fix implementation, independent evidence (local harness, 39 checks). Corpus check: 3,263 titles searched for \"magic link\", \"email link\", \"login CSRF\", \"csrf\" — no ticket names the email link as a login-CSRF trigger.","patch_refs":[],"thread":[]}