OAuth 2.0 and OIDC, the checks that matter
An authorization code is a short-lived secret. If the app sends it to the wrong place, or will trade it without a proof, someone else can finish the login.
This page is the review I run. It is not a bypass lab. I'm not walking through a stolen-code exchange.
What I check
- Redirect URI. The identity provider stores the full callback and matches it exactly. Prefix matches, open redirects on the callback, and "any subdomain" are the failures I look for.
- PKCE. Public clients (a browser app, a mobile app) must send
code_challengewith S256, and the token request must send the matching verifier. If the server still completes the login without that pair, the check is off. - State. The app sets a random
statevalue, ties it to the browser session, and rejects the callback when the value is missing or different. That is what stops a login CSRF, where the victim ends up in someone else's account link. - Host header. The callback URL is built from server config, not from the
Hostheader on the request. If the app trusts that header, the code can be pointed at another host.
I don't treat a CVE number on an old draft of this page as a source. If you need a specific advisory, pull it from the vendor, not from this stub.
How to prevent it
- Exact-match redirect URIs. No wildcards unless the product documents a narrow one and you have reviewed it.
- Require PKCE S256 for every public client. Reject the code exchange when the verifier is absent.
- Require
state, and bind it to the session. - Ignore the
Hostheader when you build a redirect. Use the configured issuer and callback. - Prefer authorization-code with PKCE. Don't ship the implicit flow for a new app.
The longer OAuth notes on the site are the article OAuth 2.0 and OIDC vulnerabilities and the API security testing guide. This URL stays the short version.