SKILL: OAuth Security Testing
Metadata
Description
OAuth 2.0 attack checklist: authorization code interception, redirect_uri bypass, CSRF on OAuth flow, state parameter abuse, open redirector chaining, token leakage via Referer, PKCE bypass, and scope escalation. Use when testing OAuth implementations in web apps or bug bounty.
Trigger Phrases
Use this skill when the conversation involves any of:
OAuth, OAuth 2.0, authorization code, redirect_uri bypass, OAuth CSRF, state parameter, PKCE bypass, scope escalation, token leakage, open redirector, OAuth attack
Instructions for Claude
When this skill is active:
- Load and apply the full methodology below as your operational checklist
- Follow steps in order unless the user specifies otherwise
- For each technique, consider applicability to the current target/context
- Track which checklist items have been completed
- Suggest next steps based on findings
Full Methodology
OAuth Security Testing
Shortcut
- Check for improper redirect validation (open redirects)
- Test state parameter manipulation/absence
- Manipulate OAuth flows to bypass authentication
- Try URL path traversal in redirect_uri
- Hunt for client secret leakage in source code/repos
- Look for improper scope validation
Mechanisms
- OAuth 2.0 authorizes limited access to resources via tokens; pair with OIDC for identity.
- Core Flows:
- Authorization Code (with PKCE for public clients)
- Client Credentials (service-to-service)
- Avoid Implicit and ROPC where possible
- Key Components:
- Resource Owner (user)
- Client (third-party app)
- Authorization Server (issues tokens)
- Resource Server (hosts protected resources)
- Tokens (access and refresh)
- Hardening Extensions:
- PAR (Pushed Authorization Requests), JAR (Request Objects), JARM (JWT-secured responses)
- Sender‑constrained tokens (DPoP, mTLS)
private_key_jwt or mTLS client authentication for confidential clients
OAuth/OIDC Considerations
- PKCE everywhere: Even with confidential clients/native apps;
code_verifier must be required and validated.
- Nonce/state binding: For OIDC, ensure
nonce is present and matched; state should be unguessable and tied to session.
redirect_uri exact match: Enforce exact string match against pre-registered allowlist; no wildcards/path traversal.
aud/azp/iss enforcement: Validate tokens strictly, including clock skew and JWKS kid rotation behavior.
- Front-channel logout/login CSRF: Validate logout CSRF; defend forced login to attacker accounts.
- ID Token vs Access Token: APIs must not accept ID tokens; check
token_type and audience.
- Device Code & CIBA: Validate polling rate limits, code expiry, and binding of device/user codes.
- Refresh Token Rotation: Enforce reuse detection and global invalidation chains.
- PAR/JAR/JARM: Use to pin exact redirect_uri and inputs and to protect front-channel parameters.
OAuth 2.1 Updates
- Implicit Flow Deprecated: Authorization servers should not support
response_type=token
- Password Grant Deprecated: ROPC (Resource Owner Password Credentials) considered insecure
- PKCE Mandatory: Required for all OAuth clients including confidential clients
- Exact Redirect URI Matching: No more substring or prefix matching allowed
- Refresh Token Sender Constraint: Refresh tokens should be sender-constrained via DPoP or mTLS
Financial-grade API (FAPI) Security
FAPI 1.0 Advanced Profile
- Signed Request Objects (JAR): Authorization requests as signed JWTs
- Hybrid Flow: Uses
response_type=code id_token for additional security
- MTLS Client Authentication: Certificate-bound tokens
- JARM: JWT-secured authorization response mode
- Request Object Encryption: Sensitive parameters encrypted
FAPI 2.0 Security Profile
- Pushed Authorization Requests (PAR): POST request parameters to dedicated endpoint
- DPoP (Demonstrating Proof-of-Possession): Token bound to client's key pair
- Client Authentication:
private_key_jwt or MTLS required
- Grant Management: Rich authorization requests and grant management API
graph TD
User[Resource Owner] -->|Initiates flow| Client
Client -->|Authorization Request| AuthServer[Authorization Server]
AuthServer -->|Authentication| User
User -->|Approves access| AuthServer
AuthServer -->|Authorization Code| Client
Client -->|Code + Client Secret| AuthServer
AuthServer -->|Access Token| Client
Client -->|Access Token| ResourceServer[Resource Server]
ResourceServer -->|Protected Resource| Client
style User fill:#b7b,stroke:#333,color:#333
style Client fill:#aae,stroke:#333,color:#333
style AuthServer fill:#9f9,stroke:#333,color:#333
style ResourceServer fill:#e9a,stroke:#333,color:#333
Hunt
- Intercept OAuth flows with proxy (Burp/ZAP)
- Manipulate redirect_uri parameters
- Remove/tamper state parameter
- Test PKCE implementations
- Inspect token handling in browsers
- Check for client secret leakage
- Analyze scope handling logic
- Test account linking/unlinking
- Review token validation procedures
- Examine refresh token security
Native/Mobile
- Verify App Links/Universal Links to prevent hijacking callbacks.
- Ensure OAuth proxy components in mobile apps validate issuer and JWKS; do not ship client secrets in binaries.
SPA/Browser
- Use Authorization Code + PKCE; avoid Implicit/Hybrid unless justified.
- Store tokens in memory; if cookies are used, set
__Host- prefix with HttpOnly; Secure; SameSite.
📎 Detailed content (full examples / references / data tables) has been split into reference.md in the same directory; use Read to load the relevant section on demand.
1---2name: offensive-oauth3description: "OAuth 2.0 attacks: authorization code interception, redirect_uri bypass, flow CSRF, state abuse, open redirect chains, Referer token leakage, PKCE bypass. Signals: oauth, redirect_uri."4zh-signals: "OAuth 2.0 攻击清单:授权码截获、redirect_uri 绕过、flow CSRF、state 滥用、开放重定向链、Referer 令牌泄露、PK信号:oauth,redirect_uri。"5when-to-use: OAuth Security Testing6metadata:7 source: https://skillmd.com/skills/dangeroussong/offensive-oauth8---910# SKILL: OAuth Security Testing1112## Metadata13- **Skill Name**: oauth-attacks14- **Folder**: offensive-oauth15- **Source**: https://github.com/SnailSploit/offensive-checklist/blob/main/oauth.md1617## Description18OAuth 2.0 attack checklist: authorization code interception, redirect_uri bypass, CSRF on OAuth flow, state parameter abuse, open redirector chaining, token leakage via Referer, PKCE bypass, and scope escalation. Use when testing OAuth implementations in web apps or bug bounty.1920## Trigger Phrases21Use this skill when the conversation involves any of:22`OAuth, OAuth 2.0, authorization code, redirect_uri bypass, OAuth CSRF, state parameter, PKCE bypass, scope escalation, token leakage, open redirector, OAuth attack`2324## Instructions for Claude2526When this skill is active:271. Load and apply the full methodology below as your operational checklist282. Follow steps in order unless the user specifies otherwise293. For each technique, consider applicability to the current target/context304. Track which checklist items have been completed315. Suggest next steps based on findings3233---3435## Full Methodology3637# OAuth Security Testing3839## Shortcut4041- Check for improper redirect validation (open redirects)42- Test state parameter manipulation/absence43- Manipulate OAuth flows to bypass authentication44- Try URL path traversal in redirect_uri45- Hunt for client secret leakage in source code/repos46- Look for improper scope validation4748## Mechanisms4950- **OAuth 2.0** authorizes limited access to resources via tokens; pair with **OIDC** for identity.51- **Core Flows**:52 - Authorization Code (with PKCE for public clients)53 - Client Credentials (service-to-service)54 - Avoid Implicit and ROPC where possible55- **Key Components**:56 - Resource Owner (user)57 - Client (third-party app)58 - Authorization Server (issues tokens)59 - Resource Server (hosts protected resources)60 - Tokens (access and refresh)61- **Hardening Extensions**:62 - PAR (Pushed Authorization Requests), JAR (Request Objects), JARM (JWT-secured responses)63 - Sender‑constrained tokens (DPoP, mTLS)64 - `private_key_jwt` or mTLS client authentication for confidential clients6566### OAuth/OIDC Considerations6768- **PKCE everywhere**: Even with confidential clients/native apps; `code_verifier` must be required and validated.69- **Nonce/state binding**: For OIDC, ensure `nonce` is present and matched; `state` should be unguessable and tied to session.70- **`redirect_uri` exact match**: Enforce exact string match against pre-registered allowlist; no wildcards/path traversal.71- **`aud`/`azp`/`iss` enforcement**: Validate tokens strictly, including clock skew and JWKS `kid` rotation behavior.72- **Front-channel logout/login CSRF**: Validate logout CSRF; defend forced login to attacker accounts.73- **ID Token vs Access Token**: APIs must not accept ID tokens; check `token_type` and audience.74- **Device Code & CIBA**: Validate polling rate limits, code expiry, and binding of device/user codes.75- **Refresh Token Rotation**: Enforce reuse detection and global invalidation chains.76- **PAR/JAR/JARM**: Use to pin exact redirect_uri and inputs and to protect front-channel parameters.7778### OAuth 2.1 Updates7980- **Implicit Flow Deprecated**: Authorization servers should not support `response_type=token`81- **Password Grant Deprecated**: ROPC (Resource Owner Password Credentials) considered insecure82- **PKCE Mandatory**: Required for all OAuth clients including confidential clients83- **Exact Redirect URI Matching**: No more substring or prefix matching allowed84- **Refresh Token Sender Constraint**: Refresh tokens should be sender-constrained via DPoP or mTLS8586### Financial-grade API (FAPI) Security8788#### FAPI 1.0 Advanced Profile8990- **Signed Request Objects (JAR)**: Authorization requests as signed JWTs91- **Hybrid Flow**: Uses `response_type=code id_token` for additional security92- **MTLS Client Authentication**: Certificate-bound tokens93- **JARM**: JWT-secured authorization response mode94- **Request Object Encryption**: Sensitive parameters encrypted9596#### FAPI 2.0 Security Profile9798- **Pushed Authorization Requests (PAR)**: POST request parameters to dedicated endpoint99- **DPoP (Demonstrating Proof-of-Possession)**: Token bound to client's key pair100- **Client Authentication**: `private_key_jwt` or MTLS required101- **Grant Management**: Rich authorization requests and grant management API102103```mermaid104graph TD105 User[Resource Owner] -->|Initiates flow| Client106 Client -->|Authorization Request| AuthServer[Authorization Server]107 AuthServer -->|Authentication| User108 User -->|Approves access| AuthServer109 AuthServer -->|Authorization Code| Client110 Client -->|Code + Client Secret| AuthServer111 AuthServer -->|Access Token| Client112 Client -->|Access Token| ResourceServer[Resource Server]113 ResourceServer -->|Protected Resource| Client114115 style User fill:#b7b,stroke:#333,color:#333116 style Client fill:#aae,stroke:#333,color:#333117 style AuthServer fill:#9f9,stroke:#333,color:#333118 style ResourceServer fill:#e9a,stroke:#333,color:#333119```120121## Hunt122123- Intercept OAuth flows with proxy (Burp/ZAP)124- Manipulate redirect_uri parameters125- Remove/tamper state parameter126- Test PKCE implementations127- Inspect token handling in browsers128- Check for client secret leakage129- Analyze scope handling logic130- Test account linking/unlinking131- Review token validation procedures132- Examine refresh token security133134#### Native/Mobile135136- Verify App Links/Universal Links to prevent hijacking callbacks.137- Ensure OAuth proxy components in mobile apps validate issuer and JWKS; do not ship client secrets in binaries.138139#### SPA/Browser140141- Use Authorization Code + PKCE; avoid Implicit/Hybrid unless justified.142- Store tokens in memory; if cookies are used, set `__Host-` prefix with `HttpOnly; Secure; SameSite`.143144> 📎 Detailed content (full examples / references / data tables) has been split into `reference.md` in the same directory; use Read to load the relevant section on demand.