Key Takeaways

Why API Authentication Testing Matters for Bug Bounty

APIs are the backbone of every modern application. Mobile apps, SPAs, microservices, third-party integrations — they all authenticate through API endpoints. When that authentication breaks, attackers get direct access to user data, admin functionality, and backend systems without ever touching the web UI.

Broken authentication consistently ranks at the top of the OWASP API Security Top 10. Bug bounty programs pay premium rates for auth bypass findings because the impact is immediate: account takeover, data exfiltration, or privilege escalation to admin. If you can prove you bypassed authentication on a production API, you're looking at high to critical severity payouts.

Reconnaissance: Mapping API Authentication Surfaces

Before attacking auth, you need to understand what auth mechanisms the target uses and where they're enforced.

Identifying Auth Mechanisms

Start by cataloging every authentication method the API accepts. Most targets use more than one:

Endpoint Discovery

Auth enforcement is only as strong as its weakest endpoint. Find every endpoint the API exposes:

JWT Attacks: The Most Common API Auth Vulnerability

JWTs are everywhere, and they're misconfigured more often than not. Here's what to test.

Algorithm Confusion (alg:none and RS256→HS256)

The classic JWT attack. If the server accepts "alg": "none", you can strip the signature entirely and forge any claims. Test with jwt_tool:

python3 jwt_tool.py <token> -X a

For RS256 to HS256 confusion: if the server uses RS256 (asymmetric) but also accepts HS256 (symmetric), you can sign a forged token using the server's public key as the HMAC secret. This works because the server uses the same key material for verification regardless of algorithm.

Weak Signing Secrets

Many JWTs are signed with weak or default secrets. Crack them offline:

hashcat -a 0 -m 16500 <token> /path/to/wordlist.txt

Common weak secrets include secret, password, the application name, and UUIDs that appear elsewhere in the application. Once cracked, you can forge tokens with any claims — admin access, different user IDs, elevated roles.

Missing Expiration and Claim Validation

Test whether the server actually validates critical claims:

JWK Injection and x5u/jku Abuse

Some JWT libraries allow the token itself to specify the verification key via the jwk header parameter or a URL (jku, x5u). If the server fetches and trusts these:

  1. Generate your own RSA key pair
  2. Host the public key at a URL you control
  3. Set the jku header to your URL
  4. Sign the token with your private key

The server fetches your public key and validates the signature you created — complete auth bypass.

OAuth and OIDC Token Attacks

OAuth implementations are complex, and complexity breeds vulnerabilities. Focus on the gaps between the spec and the implementation.

Redirect URI Manipulation

The redirect_uri parameter controls where authorization codes and tokens are sent. Test for:

Token Leakage

OAuth tokens leak through multiple channels:

Scope Escalation

Request more scopes than the application normally uses. Many OAuth servers don't validate requested scopes against the client's allowed scopes:

scope=openid profile email admin:write users:delete

If the server grants elevated scopes, you've escalated privileges through the OAuth flow itself.

GraphQL Authentication Bypass

GraphQL APIs consolidate multiple operations behind a single endpoint, which creates unique auth bypass opportunities.

Introspection-Guided Auth Testing

If introspection is enabled, query the full schema to find mutations and queries that should require authentication:

{
  __schema {
    mutationType {
      fields {
        name
        args { name type { name } }
      }
    }
  }
}

Then call each mutation without an auth token. Developers frequently protect the main queries but forget to gate admin mutations, internal tooling queries, or newly added fields.

Query Batching and Alias-Based Bypass

Some GraphQL rate limiters and auth checks only inspect the first query in a batch. Send multiple operations in a single request:

[
  {"query": "{ publicData { id } }"},
  {"query": "mutation { deleteUser(id: \"target\") { success } }"}
]

Alternatively, use aliases to call the same field multiple times with different arguments — useful for brute-forcing auth tokens or OTPs through a single request that bypasses per-request rate limits.

Field-Level Authorization Gaps

GraphQL resolvers may enforce auth at the query level but not at the field level. If you can access a user query, try requesting fields that should be restricted:

{ user(id: "self") { email passwordHash apiKey internalRole } }

gRPC Authentication Testing

gRPC services are increasingly common in microservice architectures. Their auth model differs from REST APIs.

Metadata-Based Auth Spoofing

gRPC uses metadata (similar to HTTP headers) for authentication. When a load balancer or API gateway sits in front of the gRPC service, it may inject auth metadata that the backend trusts implicitly:

grpcurl -plaintext -H "x-authenticated-user: admin" -H "x-user-role: superadmin" target:50051 service.AdminService/ListUsers

If the backend trusts these headers without validating them against the actual token, you can impersonate any user.

Reflection-Enabled Service Discovery

gRPC server reflection exposes all available services and methods — the equivalent of GraphQL introspection. Use it to find internal services that lack auth:

grpcurl -plaintext target:50051 list
grpcurl -plaintext target:50051 describe service.InternalService

Unary vs. Streaming Auth Checks

Some implementations validate auth on unary (single request-response) calls but skip validation on streaming RPCs. Test bidirectional and server-streaming methods separately — they may have weaker or missing auth enforcement.

API Key Attacks

API keys are the simplest auth mechanism and the most frequently leaked.

Key Discovery

Key Privilege Testing

Once you have a key, test what it can access. Many API keys have broader permissions than the application uses:

Practical Exploitation Chains

The highest-impact findings chain multiple auth weaknesses together.

Chain 1: JWT None Algorithm → Admin Takeover

  1. Capture a valid JWT from a low-privilege account
  2. Decode the payload — note the role and user ID claims
  3. Set alg to none, change role to admin, strip the signature
  4. Send the forged token to admin-only endpoints
  5. If accepted: full admin access from an unprivileged account

Chain 2: OAuth Redirect + Token Theft → Account Takeover

  1. Find an open redirect on the target domain
  2. Craft an OAuth authorization URL with redirect_uri pointing to the open redirect, which forwards to your server
  3. Send the link to a victim (or demonstrate the flow in your report)
  4. Capture the authorization code or token when it arrives at your server
  5. Exchange the code for an access token — you now have the victim's session

Chain 3: GraphQL Introspection → Hidden Mutation → Privilege Escalation

  1. Run introspection to discover all mutations
  2. Find an updateUserRole or setAdmin mutation not exposed in the UI
  3. Call it with your own user ID and an elevated role
  4. Verify your account now has admin privileges

Tools and Workflow

ToolPurposeUse Case
jwt_toolJWT analysis and attackAlgorithm confusion, claim tampering, brute-force secrets
Burp Suite + JWT EditorIntercept and modify JWTs in-flightReal-time token manipulation during testing
NucleiAutomated API vulnerability scanningRun API-auth templates against discovered endpoints
InQL / GraphQL VoyagerGraphQL schema analysisVisualize auth boundaries and find ungated operations
grpcurlgRPC endpoint testingService discovery, metadata spoofing, method enumeration
Postman / InsomniaAPI explorationBuild and replay auth flows with modified parameters
hashcatJWT secret crackingOffline brute-force of HMAC signing secrets
trufflehog / gitleaksSecret scanningFind leaked API keys in repositories and codebases

Writing High-Impact Reports

API auth bypass reports need to clearly demonstrate the impact. Include:

Conclusion

API authentication testing is one of the highest-ROI skills in bug bounty. Every target has APIs, most have auth flaws, and the payouts for auth bypass are consistently at the top of the severity scale. Start with JWT analysis — it's the most common and most exploitable. Then expand to OAuth flows, GraphQL auth boundaries, and gRPC metadata. The tools are mature, the attack patterns are well-documented, and the targets are everywhere.

Focus on the gaps between what the spec says and what the implementation does. That's where the bounties live.

Advertisement