Lab 10: OAuth 2.0 Attack Chain

Objective

Exploit three OAuth 2.0 implementation flaws in a live authorization server from Kali Linux:

  1. Missing state parameter — no CSRF protection on the OAuth flow; attacker can force-bind their own OAuth account to a victim's account

  2. client_secret not verified — exchange an authorization code without providing the correct client secret

  3. Excessive data exposure via access token — the userinfo endpoint returns api_key regardless of the requested scope


Background

OAuth 2.0 is the authorization framework underlying "Login with Google/GitHub/Facebook" across millions of sites. Implementation flaws are ubiquitous because the spec leaves many details to implementors.

Real-world examples:

  • 2014 "Covert Redirect" (Wang Jing) — open redirect in OAuth redirect_uri combined with missing state check; attacker could capture authorization codes from legitimate users.

  • 2018 Facebook Access Token Exposure — "View As" feature leaked access tokens via a video upload OAuth flow; 50M accounts affected.

  • 2021 Expo (React Native) OAuth — missing state check in the Expo SDK OAuth helper; attacker could force-associate their credentials with any victim account by tricking them into clicking a crafted OAuth link.

  • 2023 Microsoft Azure AD — authorization code exchange didn't validate redirect_uri at the token endpoint; code could be exchanged from any redirect target.

OWASP: A01:2021 (Broken Access Control), A07:2021 (Auth Failures)


Architecture

Time

40 minutes


Lab Instructions

Step 1: Setup


Step 2: Launch Kali + Understand Normal OAuth Flow


Step 3: Attack 1 — Missing State (CSRF on OAuth)

📸 Verified Output:


Step 4: Attack 2 — client_secret Not Verified


Step 5: Attack 3 — Excessive Data Exposure

📸 Verified Output:


Steps 6–8: Full Attack Chain + Remediation + Cleanup


Further Reading

Last updated