Skip to content

In-depth lesson · technique

OAuth state and CSRF

What every disclosed OAuth state and CSRF report in the index teaches, put together: how it works, how it changed year by year, where it turns up, and things to try. Every point shows the reports it is seen in.

reports cited in this lesson
36

Overview

What it is and why programs pay for it.

This lesson covers flaws in the state parameter and related CSRF protections in OAuth and single sign-on flows. In a correct flow, the client generates a random, unguessable value per session, sends it with the authorisation request, and checks it when the provider redirects back. When that value is missing, predictable, reused, or not actually enforced, an attacker can bind their own authorisation code or provider account to a victim's session. The evidence shows this across many account-linking and import features, including third-party integrations and project import flows, and in exported Android activities that handle OAuth and SSO redirects.

Programs care because the result is account takeover or unwanted account linking: a victim's account ends up connected to the attacker's provider account, or the attacker's code completes inside the victim's session. It also appears in import flows where a captured callback can be replayed by another user. The reports behind this lesson span 37 items, 36 with summaries and 5 paid, so it is a recurring class rather than a one-off.

It turns up most often in account-linking settings pages, project import flows, and mobile OAuth or SSO redirect handling. The underlying mistakes are consistent: no state parameter at all, a state value that stores a redirect location instead of a token, a predictable value such as a user ID, a check that only tests presence, or a callback that is not bound to the session that started the flow.

How it works

The mechanics, as the reports show them.

The user starts an OAuth or SSO flow. The client should create a random state value, store it against the user's session, and include it in the authorisation request. The provider authenticates the user and redirects back with a code and the state. The client compares the returned state with the stored one and only then exchanges the code. The flaw appears when any of these steps is skipped or weakened.

The simplest failure is a missing state parameter, so nothing binds the callback to the browser that started the flow. A related failure is a state value that is not per session, so a completed callback can be replayed into another session. In both cases an attacker can obtain a code in their own flow and get a victim's browser to submit it, linking the attacker's provider account to the victim.

A second family is a state parameter that exists but is not a CSRF token. It may store a redirect location, a persistent user ID, or a client-controlled decodable blob that tells client-side JavaScript where to send the code. These values can be edited or guessed, so the check does not protect the flow and may itself become an open redirect or code-leak vector.

A third family is a check that is present but ineffective. The server may accept requests where state is missing, compare only up to a null byte, or skip the check for applications marked trusted. The callback may also be reachable by most authenticated users without validating the caller. Each of these lets a crafted callback complete in the wrong context.

Mobile and redirect-handling code adds another route. An exported activity may republish any received URI as a completed flow without checking state, PKCE verifier, or caller identity. Wildcard-scoped session cookies can also let a subdomain set the session used for the OAuth check, undermining the protection even when a state value exists.

What makes all of this possible is that the authorisation code or token is a bearer credential. If it is not tied to the session that started the flow, whoever can get it submitted in a victim's browser can complete the link. The fix is a random per-session state value that is rejected when missing or mismatched, plus binding the code to the session and validating redirect URIs by exact path.

Year by year

3 years

What each year's disclosed reports show, newest first. A year with few reports says less.

Reports per yearPeak 2025: 10
Reports per year
20141
20152
20161
20191
20213
20222
20243
202510
20268
  1. 2026

    8 reports

    New this year3

    • Supplying the attacker's own URI as the exchange redirect URI in an Android app's login flow to see whether a stolen code can be redeemed appears in the disclosed reports.
    • Sending a crafted redirect URI to an exported activity that handles OAuth and SSO redirects to see whether it treats it as a completed login appears in the disclosed reports.
    • Registering a redirect URI that matches only the origin of the target domain, then aiming it at an open redirect on that domain to forward the code, appears in the disclosed reports.

    Kept working6

    • Exported Android activities that handle OAuth and SSO redirects, along with mobile app token exchange, were places where this flaw appeared in the disclosed reports.
    • Triggering the OAuth login start endpoint cross-site with the Referer header set to a page the attacker controls, then observing where the user is sent after authentication, worked in the disclosed reports.
    and 4 more
  2. 2025

    10 reports · median $5,580

    New this year4

    • Changing response_mode to fragment so the authorisation code lands in the URL fragment, combined with an open redirect and a missing state check, first appears in the disclosed reports.
    • Testing whether the token endpoint accepts an exchange without a valid client secret and whether it checks the redirect URI against a whitelist appears in the disclosed reports.
    • Applications marked trusted by default skipping the CSRF check on the authorisation flow, so a crafted link yields a code without consent, appears in the disclosed reports.
    and 1 more

    Kept working6

    • Hunters chained a missing state check with a second weakness such as an open redirect, a Referer-driven redirect or a cross-site confirmation step in the disclosed reports.
    • Checking OAuth requests on a secondary subdomain for a missing state parameter, then sending a login link carrying the attacker's own code to force a victim into the attacker's account, worked in the disclosed reports.
    and 4 more
  3. 2024

    3 reports

    Kept working5

    • Hunters tested account-linking callbacks by completing the connect step in a victim's browser to see whether the attacker's third-party account bound to the victim, as in the Facebook linking flow in the disclosed reports.
    • Comparing state values across two sign-ins in turn revealed predictable state tokens within a time window in the disclosed reports.
    and 3 more
Every point, year by year

Where it is found

3

The features and places the reports found it in, most-reported first.

  1. Account-linking flows for third-party integrations, such as those on Google Drive, Pinterest, Twitch, Facebook, Bitbucket, GitHub, Salesforce and Google, are places where this flaw appears.

    Seen in 8 reports
  2. Project import flows and account-linking settings pages are features where this flaw turns up.

    Seen in 4 reports
  3. Exported Android activities that handle OAuth and SSO redirects, along with mobile app token exchange, are places where this flaw appears.

    Seen in 2 reports

Technologies in these reports5

Root causes

12

The mistakes in the code or configuration behind the reports.

  1. The authorisation request was built without a state parameter, so no anti-CSRF token bound the callback to the user's session.

    Seen in 1 report
  2. No per-session state value tied the authorisation request to the browser that started it, so a completed callback could be replayed into another session.

    Seen in 1 report
  3. The state parameter was used to store a redirect location instead of a CSRF token, so it could be edited to send the token elsewhere after login.

    Seen in 1 report
  4. The state parameter was predictable, being identical for all users within a time frame.

    Seen in 1 report
  5. The authorisation code was not bound to the user's session, so an attacker's code could be injected into a victim's pending flow.

    Seen in 1 report
View all 12

Things to try

The most-reported tests in the largest contexts. Tick what you have tried; ticks stay in this browser and carry over to the full checklist. Test only what a program's scope allows.

ticked in this lesson

Account linking and social connect

of 3 ticked
More in Account linking and social connect

State parameter handling and predictability

of 3 ticked
More in State parameter handling and predictability

Response type, mode and redirect URI manipulation

of 3 ticked
More in Response type, mode and redirect URI manipulation

Callback replay and cross-user code reuse

of 3 ticked
View more things to try

Bypasses and variations

4

How reports got past filters, encoders and other defences.

  1. A comparison that stops at a null byte ignores anything after it, so the state check passes with a modified value.

    Seen in 1 report
  2. Applications marked trusted by default skip the CSRF check on the authorisation flow, so a crafted link yields a code without consent.

    Seen in 1 report
  3. Weak postMessage listeners or third-party scripts on error pages can leak the URL that still carries the code or token.

    Seen in 1 report
  4. Initialising the SDK through a crafted URL satisfies its postMessage requirement so the callback can be triggered cross-site.

    Seen in 1 report

Payouts

5 paid

Public bounties in US dollars, from the data. 5 of 41 reports show an amount.

a quarter paid up to
$3,750
median
$5,000
three quarters paid up to
$5,580
highest
$25k

One in ten paid reports was paid $17k or more.

SeverityReportsPaidMedianHighest
High 2 1 $5,580 $5,580
Medium 2 0 None paid None
Low 1 0 None paid None
Unrated 36 4 $4,375 $25k

Highest-paid reports5

Typical fixes

3

How programs fixed it, as the reports describe.

  1. Generate a random, unguessable state value per session and reject callbacks where it is missing or does not match.

    Seen in 3 reports
  2. Bind the authorisation code to the session that started the flow so a code from another session cannot complete it.

    Seen in 2 reports
  3. Validate redirect URIs by exact path against a whitelist rather than by origin alone.

    Seen in 2 reports

Tips for beginners

14

Advice for a first hunt, drawn from the reports.

  1. Start with account-linking settings pages and project import flows. These are the most common places in the evidence, and they are easy to reach with a normal account.

    Seen in 3 reports
  2. If state is present, look at what it stores. A redirect location, a user ID, or a decodable blob is not a CSRF token and should be reported as such.

    Seen in 3 reports
  3. First check whether a state parameter is present at all in the authorisation request. A missing state is the simplest finding and the easiest to demonstrate.

    Seen in 2 reports
  4. Compare state values across two logins or two accounts. If the value is the same within a time window, it is predictable and the protection is ineffective.

    Seen in 2 reports
  5. Test whether the server actually rejects a missing or modified state. Some servers check presence but accept requests where it is absent, and some comparisons stop at a null byte.

    Seen in 2 reports
View all 14

Guides and techniques

The best explainers, cheat sheets and technique posts on OAuth state and CSRF, from around the web.

Keep learning

Where this lesson fits, and what to read next.

How this is made: our model read every listed OAuth state and CSRF report in the index (our own summary where we have one, otherwise the title and the platform's label), listed the patterns, and merged them. Each point was kept only if the reports it cites exist, are listed and belong here; payouts are computed from the data, not written by the model. Read the originals before relying on a point. Generated 28 Nov 2026 from 37 reports. All OAuth state and CSRF reports.