This article is Day 18 of a 60-day bug bounty mastery course focused on OAuth 2.0 vulnerabilities in social login implementations. It maps the complete OAuth authorization code flow and identifies four critical attack vectors: missing state parameters enabling CSRF-based account takeover, loose redirect_uri validation allowing authorization code theft, token leakage via Referer headers to third-party services, and chaining these weaknesses into complete account compromise. The material matters because OAuth vulnerabilities consistently pay Critical severity in bug bounty programs and OAuth login buttons appear on nearly every modern web application.
- OAuth authorization code flow attack surfaceThe article identifies three distinct testing points in the OAuth 2.0 authorization code flow: Step 1 (authorization request) vulnerable to redirect_uri bypass, missing/weak state, and scope manipulation; Step 2 (authorization code returned in URL) vulnerable to Referer leakage and code reuse; Step 3 (token exchange server-side) vulnerable to redirect_uri mismatch bypasses. Each step involves parameters passed through browser redirects, which are trivially interceptable and modifiable.
- Missing state parameter enables account takeoverWithout the state parameter (OAuth's CSRF token), an attacker can initiate an OAuth authorization with their own account, capture the resulting callback URL containing an authorization code, and send that URL to a victim via CSRF or phishing. When the victim clicks the link, their account becomes linked to the attacker's OAuth identity, allowing the attacker to log in as the victim using their own credentials—full account takeover without needing the victim's password.
- Redirect_uri validation bypass patternsThe article provides seven specific redirect_uri bypass patterns: path traversal (https://app.com/callback/../attacker.com), query string injection (https://app.com/callback?x=https://attacker.com), subdomain registration (https://attacker.app.com/callback), @ character confusion (https://app.com@attacker.com/callback), URL encoding, extra slashes, and localhost bypass. Authorization servers often validate domain but not path, allowing path traversal attacks that redirect authorization codes to arbitrary paths on the legitimate domain.
- Token leakage via Referer headersWhen authorization codes or access tokens appear in URLs (implicit flow or some authorization code implementations), and the page then loads third-party resources (Google Analytics, CDN scripts, fonts, ad networks), the browser automatically includes the full current URL in the Referer header sent to those third parties. Every analytics platform and CDN provider receives the authorization code in their access logs—silent credential theft without user awareness.
- State parameter must be truly random and session-boundThe article includes a real-world example where a SaaS platform's OAuth implementation included a state parameter but used a static, non-randomly-generated value that appeared identically in every authorization request. This allowed attackers who had clicked the login button once to know the state value and trick victims into completing the OAuth flow with a predictable state. The fix required cryptographically random state generation tied to the current user session, demonstrating that presence of state alone is insufficient.
- Practical OAuth mapping before exploitationExercise 1 requires mapping the complete OAuth flow in DevTools before attempting any vulnerability tests: documenting the client_id, redirect_uri, state parameter (and whether it changes each request), requested scopes, and response_type. The exercise also requires checking what third-party scripts load after OAuth completion, as this reveals potential Referer leakage paths. The article emphasizes that accurate mapping is essential—you cannot test redirect_uri without knowing the legitimate value, and you cannot validate state checking without knowing whether it exists.
- Implicit flow tokens more dangerous than authorization codeThe article distinguishes response_type=token (implicit flow) from response_type=code (authorization code flow), noting that implicit flow exposes access tokens directly in the URL fragment, creating Referer leakage risk when third-party resources load. The PortSwigger lab for implicit flow authentication bypass demonstrates why implicit flow is more dangerous than the authorization code flow for token security.
- Account takeover requires chaining multiple weaknessesComplete account takeover chains combine redirect_uri bypass (to capture the authorization code), missing state CSRF (to force a victim to initiate the flow), and code exchange (to obtain an access token). Each step amplifies the others; an attacker who can redirect codes to their own server and bypass CSRF protection can fully compromise a victim's account without ever obtaining their password, even if each individual weakness might seem lower severity in isolation.
Bottom line: OAuth vulnerabilities—particularly missing state parameters, loose redirect_uri validation, and token leakage—are consistently the highest-paying findings in bug bounty programs because they enable direct account takeover without credentials. Systematic testing using the seven redirect_uri bypass patterns, state validation checks, and Referer leakage detection on any OAuth implementation is essential reconnaissance for authentication attack surfaces.
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.
📸 Save your mapped OAuth parameter list (redact any sensitive values) in your notes.
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 save it in your notes.
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 and keep them in your notes.
🧠 QUICK CHECK — Day 18
Writing the OAuth Report — Impact Framing That Gets Paid
Triage teams rate OAuth bugs by what the flaw lets an attacker take over, not by the misconfiguration itself. Frame the report around account takeover and prove it with the least intrusive evidence.
- Title: name the flaw, the endpoint and the impact, for example “Missing state parameter on /oauth/callback allows one-click account takeover”.
- Steps to reproduce: give the exact authorization request and callback, and the attacker-controlled value (missing state, loose redirect_uri, leaked code). Number every step so triage can replay it.
- Evidence: show the authorization code or token reaching a destination it should not, or one account linked to another identity. Use two test accounts you control, never a real user’s.
- Impact: state plainly that it results in account takeover or unauthorised access, and which users are affected (everyone, or those who click a link).
- Fix: recommend the specific control — exact redirect_uri matching, a verified state parameter, PKCE, and short-lived single-use codes.
Keep the proof minimal: linking your own two test accounts demonstrates the bug without touching anyone else’s data, which is what keeps a report in scope.
📋 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.

