githubEdit

OAuth/PKCE Attacks

Skill Level: Intermediate to Advanced Prerequisites: OAuth flows understanding, HTTP basics

OAuth Flow Overview

Authorization Code Flow (with PKCE):
1. Client generates code_verifier and code_challenge
2. Client redirects user to /authorize with code_challenge
3. User authenticates, server returns authorization_code
4. Client exchanges code + code_verifier for tokens at /token
5. Server validates code_verifier matches code_challenge
6. Server returns access_token (and optionally refresh_token)

Reconnaissance

Endpoint Discovery

# Common OAuth endpoints
/.well-known/openid-configuration
/.well-known/oauth-authorization-server
/oauth/authorize
/oauth/token
/oauth2/authorize
/oauth2/token
/authorize
/token
/auth
/login/oauth/authorize

# Fetch OpenID configuration
curl https://target.com/.well-known/openid-configuration | jq

# Extract endpoints
curl -s https://target.com/.well-known/openid-configuration | jq '{
  authorization: .authorization_endpoint,
  token: .token_endpoint,
  userinfo: .userinfo_endpoint,
  jwks: .jwks_uri,
  introspection: .introspection_endpoint,
  revocation: .revocation_endpoint
}'

Client Discovery

Authorization Code Attacks

Open Redirect via redirect_uri

Authorization Code Interception

Authorization Code Replay

PKCE Attacks

Missing PKCE Enforcement

Weak Code Challenge

Code Verifier Brute Force

Token Attacks

Access Token Leakage

Token Theft via XSS

Refresh Token Attacks

State Parameter Attacks

CSRF via Missing State

State Fixation

State Injection

Scope Manipulation

Scope Upgrade

Scope Downgrade Attack

JWT Token Attacks

Algorithm Confusion

Key Injection (jwk/jku)

JWT Claims Manipulation

Client Credential Attacks

Client Secret Exposure

Client Authentication Bypass

Social Login Attacks

Account Takeover via OAuth

Pre-Account Takeover

Tools

OAuth Testing Tools

OAuth 2.1 Changes

Checklist

Last updated

Was this helpful?