SuperAPI AI Directory

oauth-sso-attack

Security & auditing

View repository

Updated 10-16 04:43

About this skill

OAuth/SSO attack methodology

OAuth 2.0 is the most common third-party authentication protocol in modern web applications. The attack surface is concentrated in the various redirect steps of the authentication flow—redirect_uri validation, the state parameter, and token transmission.

⛔ In-depth reference (required reading)

Phase 1: Identify the OAuth flow

Click "Third-party login" and observe the redirect URL for the client_id, redirect_uri, response_type, scope, state。

Check the endpoints:/.well-known/openid-configuration, /oauth/authorize, /api/auth/providers

Phase 2: redirect_uri hijacking (most common)

Goal: make the code/token be sent to an attacker URL. Quick test:

redirect_uri=https://target.com/callback/../evil
redirect_uri=https://evil.target.com/callback
redirect_uri=https://target.com/callback?next=https://evil.com
redirect_uri=https://evil.com/steal

→ Full payload list → references/oauth-attack-vectors.md

Phase 3: Missing state → CSRF attack

When there is no state parameter: the attacker obtains the code → constructs a callback link → induces the victim to click it → the account is bound to the attacker's third-party account

Phase 4: Token leakage

  • Referer leakage: the callback page contains external resources → the token leaks via the Referer header
  • Implicit Flow:response_type=token → access_token in the URL fragment
  • Logs: the code is in the URL query and may be recorded

Phase 5: Other attack surfaces

  • Scope escalation:scope=openid profile email admin
  • client_secret leakage: check JS source code/GitHub/config files
  • Account takeover: email match merging → references/oauth-attack-vectors.md

Phase 6: CTF and account takeover

6.1 OAuth in CTFs

  • Focuses on redirect_uri bypass, with the flag in the admin token or a high-privilege scope API

6.2 Account takeover — email pre-association attack

  1. The attacker registers attacker@target.com(suffix matching exploitation)
  2. Change the email on the third-party platform to the victim's email
  3. When the victim logs in via OAuth, it is automatically linked to the existing account (email match)
  4. Key: check whether the target verifies email (bypass email verification)