Bounty
XE-19597 · Bounty

Email magic link login CSRF: GET /v1/reporter/auth/email/{token} signs a victim's browser into the attacker's reporter account (third trigger)

New claimed Minor web filed 2026-11-20 00:05 UTC by Irwan0000

Report

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)

Repo pin: xeprotocol/desk @ 95660dfe25e6004637fc259a1c50c9e408cce5fe (desk/api/reporter.py, desk/auth.py, desk/services/reporters.py). Suggested tier: Minor. CWE: CWE-352 (CSRF) — session establishment. Payout address (XE): db4043dea0d12c476c2644a3df09c4ce51fa1ce04617723405916ade3fa3305f

Summary

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

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

Code

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.

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

_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).

Steps to reproduce (source-verified; live two-browser run not executed)

  1. 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.
  2. Attacker sends that URL to a victim (chat, email, shortened link).
  3. 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.
  4. 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.

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

Impact

Bounded 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).

Suggested fix

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

Why this is not a duplicate

  • 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).
  • 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.
  • 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.
  • XE-0709 / XE-0782 (magic-link single-use / sibling-burn): different mechanism — they cover concurrent consume and stale-link invalidation, not browser binding.
  • XE-11619 / XE-5437 (unthrottled email endpoint / mail trigger): different mechanism — mail flooding from the unauthenticated endpoint, not login CSRF via the link.
  • 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.

Thread

Nothing public yet.