OAuth callback completes sign-in without binding the state to the initiating browser (login CSRF)
Report
Area: desk/api/reporter.py (OAuth callback flow)
Summary
The OAuth state parameter is a random, single-use, 5-minute row, but it is never bound to the browser that started the flow. An attacker mints a state via GET /v1/reporter/auth/github, completes the GitHub authorization for their own account, and sends the victim the callback URL /v1/reporter/auth/github/callback?code=<attacker code>&state=<attacker state>. The victim's browser is then signed in as the attacker's reporter identity — classic login CSRF. Impact is bounded (the victim's subsequent filings are attributed to the attacker's account; the reverse direction — adding an identity to the victim's account — is correctly blocked by the link_to binding and the refusal to merge by email), but a victim may continue working unaware that reports, messages and reputation accrue to someone else's identity.
Evidence
- desk/api/reporter.py:82-93
_oauth_statestores onlynextandlink_to; no browser/session binding - desk/api/reporter.py:148-185 GitHub callback; desk/api/reporter.py:225-265 Discord callback — both trust any presented state
- desk/api/reporter.py:128-136
_take_stateguarantees single use, which also means the attacker's minted state is consumed by the victim's browser and cannot be reused for forensics - desk/api/reporter.py:139-145
_link_targetand desk/api/reporter.py:280-282 / services/reporters.py:219-241 correctly block identity grafting and email merge (mitigations)
Preconditions The victim clicks an attacker-supplied callback URL within the 5-minute state window while not already holding a reporter session (or accepts replacing it when the state carries link_to — which an attacker cannot mint for a specific victim).
Fix Bind the state row to the initiating browser: set a short-lived nonce cookie (SameSite=Strict or Lax) at /auth/{github,discord} and require it to match the state row at the callback; alternatively store the initiating session id in the state row and require the same session at the callback.
Thread
Thanks. This is the same finding as an earlier report that is not public, 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, file a new report that links https://bounty.xe.network/XE-17987 and says what differs; it is read like any other.