This article teaches OAuth 2.0 vulnerability testing for bug bounties, focusing on four critical attack classes: missing state parameters enabling CSRF, redirect_uri validation bypasses allowing code theft, token leakage via Referer headers, and account takeover chains combining these weaknesses. The material matters because OAuth flaws consistently pay Critical severity in bug bounty programs and affect nearly every modern application with social login functionality.
- OAuth authorization code flow attack surfaceThe OAuth flow involves four entities (user, client application, authorization server, resource server) communicating through three browser-interceptable steps: the authorization request with client_id, redirect_uri, and state parameters; the authorization code return in the callback URL; and the token exchange validation. Each step presents distinct testing vectors—redirect_uri and state in Step 1, code in the URL in Step 2, and redirect_uri matching in Step 3.
- Missing state parameter enables CSRF account takeoverWithout a state parameter, an attacker can initiate an OAuth flow with their own account, capture the authorization code in the callback URL, send that URL to a victim via phishing or CSRF, and when the victim clicks it, the victim's account becomes linked to the attacker's OAuth identity. The attacker can then log in as the victim using their own OAuth credentials, achieving full account takeover without the victim's password.
- State parameter validation must be checked thoroughlyMerely checking for state presence is insufficient—the article demonstrates that a real-world vulnerability involved a state parameter that was static rather than randomly generated. The article requires testing three conditions: state must exist, must change each time (randomly generated), and must be tied to the user's session. Testing involves modifying the state value in the callback and checking if the application accepts tampered values.
- Redirect URI validation bypass patternsSeven distinct redirect_uri bypass patterns can redirect authorization codes to attacker-controlled destinations: path traversal (callback/../attacker.com), query string injection (callback?x=attacker.com), subdomain matching (attacker.app.com), @ character confusion (app.com@attacker.com), URL encoding variations, extra slashes, and localhost bypass. Testing each systematically in Burp Repeater reveals authorization servers that validate domain but not path, or fail to validate specific bypass techniques.
- Token leakage through Referer header to third partiesWhen authorization codes or access tokens appear in callback URLs and the page loads third-party resources (analytics, CDN, fonts, ads), the browser automatically sends the full URL including credentials in Referer headers to those third parties. Detection involves checking whether code= appears in the callback URL and whether third-party scripts load after OAuth completion, indicating silent credential theft without requiring interception tools.
- Implicit flow exposes tokens directly in URLThe implicit flow with response_type=token places access tokens directly in the URL fragment rather than issuing an authorization code. While fragments technically do not send in Referer headers, the article warns that JavaScript can read location.hash and leak credentials via postMessage or window.open calls, making implicit flow inherently more dangerous than the authorization code flow.
- Complete account takeover chain requires multiple weaknessesFull account takeover combines redirect_uri bypass (to steal the authorization code), missing state or weak state validation (to force a victim into the OAuth flow), and successful code exchange (to log in as the victim). The article emphasizes that each step amplifies the others—code theft alone is insufficient without forcing a victim into the flow, and CSRF alone is insufficient without a way to access the victim's account.
- Practical OAuth testing workflow and escalationThe article prescribes a three-step testing sequence: first map the OAuth flow using browser DevTools to identify all parameters and third-party scripts; second, test for missing or weak state parameter using Burp Repeater to modify callback values; third, test redirect_uri validation by systematically trying seven bypass patterns. The article includes three hands-on exercises—browser-based parameter mapping, PortSwigger lab exploitation, and Burp Intruder payload testing—to demonstrate real-world exploitation.
Bottom line: OAuth vulnerabilities—particularly missing state parameters, redirect_uri validation bypasses, and token leakage—are consistently Critical severity findings in bug bounties because they enable direct account takeover without requiring victim passwords. Testing requires systematic parameter analysis, validation bypass attempts, and Referer header inspection combined into a complete exploitation chain demonstrating how weaknesses compound into full compromise.
FREE
Part of the 60-Day Bug Bounty Mastery Course
🎯 What You’ll Master in Day 18
⏱️ 50 min read · 3 exercises
📋 What You’ll Master — OAuth Bug Bounty 2026
In Day 17 you exploited JWT vulnerabilities to forge authentication tokens. OAuth sits one layer above — it is the flow that issues the tokens JWT attacks target. Understanding OAuth misconfigurations combined with JWT attacks gives you the complete authentication attack surface in the 60-Day Bug Bounty Mastery Course.
The OAuth 2.0 Authorization Code Flow — What You Are Actually Attacking
The OAuth 2.0 authorization code flow involves four entities: the user, the client application (the site with the “Login with Google” button), the authorization server (Google/GitHub/Facebook), and the resource server (the API). The flow produces an authorization code, which the client application exchanges for an access token behind the scenes. Every step involves parameters passed through browser redirects — and browser redirects are trivially interceptable and modifiable.
⏱️ Time: 12 minutes · Browser DevTools · any programme in scope with OAuth login
“Login with Google”, “Login with GitHub”, or similar
OAuth login button. Only use targets within programme scope.
Step 2: Open DevTools → Network tab → check “Preserve log”
Step 3: Click the OAuth login button
Step 4: In the Network tab, find the first redirect to the
authorization server (accounts.google.com, github.com/login/oauth, etc.)
Right-click → Copy → Copy URL
Step 5: In a text editor, parse the authorization URL:
– What is the client_id?
– What is the redirect_uri value?
– Is there a state parameter? If yes, does it change each time?
– What scopes are requested?
– What is the response_type? (code vs token)
Step 6: Complete the login flow
Step 7: In Network tab, find the callback request to the
redirect_uri. Does the URL contain the authorization code?
Step 8: Check what third-party scripts load on the page
after OAuth completes (analytics, CDN, fonts, ads).
If the code was in the URL at callback, it may have leaked
via Referer to all of these.
Document: full authorization URL, all parameters, any concerns.
📸 Share your mapped OAuth parameter list (redact any sensitive values) in #day-18-oauth on Discord.
Missing State Parameter — OAuth CSRF and Account Takeover
The state parameter is OAuth’s CSRF token. Without it, an attacker can initiate an OAuth authorization with their own account, intercept the resulting redirect URL (before completing authorization), craft a CSRF payload from it, and trick a victim into visiting it. When the victim’s browser follows the link, it completes the OAuth flow — linking the attacker’s OAuth identity to the victim’s application account. The attacker can now log in as the victim using their own OAuth credentials.
redirect_uri Validation Bypass — Stealing Authorization Codes
The redirect_uri determines where the authorization server sends the authorization code after user consent. Strict validation accepts only the exact registered URI. Loose validation accepts any URI under the registered domain, or fails to check specific bypass patterns. If any modification is accepted, the authorization code is sent to the wrong destination — enabling code theft if that destination is attacker-controlled.
⏱️ Time: 25 minutes · Free PortSwigger account
Step 2: Open lab: “Authentication bypass via OAuth implicit flow”
Step 3: Complete the lab — note how the implicit flow exposes
tokens directly in the URL fragment
Step 4: Open lab: “Forced OAuth profile linking”
This demonstrates account takeover via missing state
Step 5: Follow the lab — the attack flow:
a) Intercept the OAuth link request
b) Drop the request before the state is validated
c) Send the captured URL to the “victim” (same browser
in the lab’s victim simulation)
d) The victim’s account becomes linked to your OAuth identity
Step 6: Open lab: “OAuth account takeover via redirect_uri bypass”
Test redirect_uri modifications:
– Path traversal: https://legit.com/callback/../
– Query string: https://legit.com/callback?x=
– Subdomain: https://attacker.legit.com
Observe which modifications the auth server accepts
For each lab, document:
– The specific parameter that was vulnerable
– The exact payload used
– The impact achieved (account linkage, code theft, etc.)
📸 Screenshot completed lab confirmations and share in #day-18-oauth on Discord.
Token Leakage via Referer — Silent Credential Theft
When an authorization code or access token appears in a URL — which happens in the implicit flow and in some authorization code flow implementations — and the page then loads any third-party resources (Google Analytics, CDN scripts, fonts), the browser automatically includes the full current URL in the Referer header sent to those third parties. The authorization code is in that URL. Every analytics platform, CDN provider, and ad network that the page loads will receive it in their access logs.
Building the Complete Account Takeover Chain
⏱️ Time: 15 minutes · Burp Suite · in-scope OAuth target or PortSwigger lab
📸 Screenshot a Burp Repeater request showing a modified redirect_uri test and response in #day-18-oauth on Discord. Tag #oauth2026
🧠 QUICK CHECK — Day 18
📋 OAuth Bug Bounty Checklist — Day 18
🏆 Mark Day 18 as Complete
OAuth is on the attack surface of nearly every modern web application with social login. The four vulnerability classes you learned today — missing state, redirect_uri bypass, token leakage, and account takeover chains — are consistently the highest-paying findings in OAuth testing because they directly enable account takeover.
❓ Frequently Asked Questions
What is OAuth and why is it vulnerable?
What is the OAuth state parameter?
How do I test redirect_uri validation?
What is an OAuth account takeover chain?
What comes after Day 18 in the Bug Bounty course?
Day 17: JWT Attacks Bug Bounty 2026
Day 19: CSRF Bug Bounty 2026
📚 Further Reading
- JWT Attacks Bug Bounty 2026 — Day 17 covers JWT algorithm confusion and alg:none attacks — the token-level counterpart to OAuth’s flow-level vulnerabilities, often combined into complete authentication bypass chains.
- 60-Day Bug Bounty Mastery Course — The complete course hub — Day 18 OAuth attacks are part of the authentication vulnerability phase covering Days 16–22, building from rate limiting through OAuth, CSRF, and HTTP request smuggling.
- Authentication Bypass Hub — The complete authentication bypass category covering OAuth, JWT, CSRF, SAML, and session management attacks with real-world examples and PortSwigger lab references.
- PortSwigger OAuth Attack Labs — Six interactive OAuth labs covering implicit flow bypass, forced account linking, redirect_uri bypass, and SSRF via OpenID dynamic client registration — the most comprehensive practical OAuth training available.
- OAuth 2.0 Official Specification — The OAuth 2.0 RFC specification — understanding what the standard requires versus what implementations often skip is the foundation for finding every vulnerability class covered in this guide.

