Reviewing OAuth resource server token acceptance
OAuth and OpenID Connect distribute security decisions among clients, providers and resource services. Understanding OAuth resource server token acceptance helps establish which security property the feature needs and where that property is actually enforced.
What does this involve?
Session and token controls preserve an authentication decision over time. They need a defined scope, lifetime and invalidation policy. A token should be accepted because a trusted service has verified the relevant properties, not simply because its structure looks familiar.
Therefore, the requirements listed here are OAuth or OIDC specific and should be performed after token validation and before performing authorisation based on information from the token.
Why it matters
Consider a realistic failure: one component trusts a redirect, token or identity assertion without verifying its intended binding to the current flow.
A reusable credential can let someone continue acting as an account after the intended access should have ended. Long-lived access, excessive token contents and inconsistent revocation can increase the exposure beyond the initial event.
A code audit connects a stated requirement to the implementation responsible for enforcing it. Source review and targeted behavioural checks should explain the same boundary and any relevant exceptions.
How penetration testers check for it
Review the specific control expectations below against the code, deployment and observable application behaviour.
- Confirm that the resource server only accepts access tokens that are intended for use with that service (audience). The audience may be included in a structured access token, or it can be checked using the token introspection endpoint.
- Confirm that the resource server enforces authorisation decisions based on claims from the access token that define delegated authorisation. If claims such as 'sub', 'scope', and 'authorisation_details' are present, they must be part of the decision.
- Confirm that if an access control decision requires identifying a unique user from an access token (JWT or related token introspection response), the resource server identifies the user from claims that cannot be reassigned to other users. Typically, it means using a combination of 'iss' and 'sub' claims.
- Verify that, if the resource server requires specific authentication strength, methods, or recentness, it verifies that the presented access token satisfies these constraints. For example, if present, using the OIDC 'acr', 'amr' and 'auth_time' claims respectively.
- Confirm that the resource server prevents the use of stolen access tokens or replay of access tokens (from unauthorised parties) by requiring sender-constrained access tokens, either Mutual TLS for OAuth 2 or OAuth 2 Demonstration of Proof of Possession (DPoP).
- Test logout, permission changes and credential replacement.
- Inspect replay and concurrent use according to the documented design.
How to fix it
Implement the required boundary in the component that actually performs the sensitive operation and retain focused regression coverage.
- Use appropriately scoped credentials with bounded lifetimes.
- Validate trusted issuance and relevant claims consistently.
- Rotate and revoke according to the session model.
- Keep credentials out of unnecessary URLs, logs and persistent copies.
Some designs intentionally use short-lived credentials without immediate global revocation. Assess the complete lifetime and access model before calling that design a failure.
Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.
Related issues
- Auditing OAuth authorisation server grants and token issuance
- OAuth access token audience and scope validation in APIs
- Implementing OAuth flows with safe redirects and token boundaries
Read about our methodology or contact pentested.com to discuss the security of your application code.