OAuth Implicit Flow in Use
The application obtains OAuth access tokens through the implicit flow, which returns them in the browser's address bar, where they are easier to leak, steal or inject.
| Severity | Low |
| CVSS 3.1 | 3.1 CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N Open in the calculator |
| CVSS 4.0 | 2.3 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-522: Insufficiently Protected Credentials |
| OWASP Top 10 | A06:2025 Insecure Design |
| MITRE ATT&CK | T1528 Steal Application Access Token, T1550.001 Application Access Token |
| Category | Insecure Design |
Description
In the OAuth 2.0 implicit grant, requested with response_type=token (or id_token token in OpenID Connect), the authorisation server returns the access token directly in the fragment of the redirect address, instead of issuing a code that the client exchanges for a token. The flow was designed for browser-based applications at a time when browsers could not make cross-origin requests to a token endpoint, and older single-page application libraries and identity platform configurations still use it.
Placing the token in the address exposes it in more places: browser history, scripts running on the redirect page (including third-party scripts), open redirects that carry the fragment on to another site, and malicious browser extensions. The flow does not expose tokens by itself, but it makes it more likely that a token is leaked or stolen through another weakness, such as cross-site scripting on the client or a compromised script, and an attacker who obtains a token can use it within its scopes until it expires. The client also cannot tell whether a token it receives was issued to it, so a token obtained elsewhere can be injected into the flow, and the token cannot be bound to the client that requested it, which leaves no way to stop a stolen token being used elsewhere.
The IETF's OAuth 2.0 Security Best Current Practice therefore advises that clients should not use the implicit grant, or any other response type that returns access tokens from the authorisation endpoint. Exploitation still depends on a further weakness and on the user signing in, and the tokens involved are usually short-lived, which keeps the typical risk low.
The weakness is identified by observing response_type=token or id_token token in authorisation requests and an access_token value in the fragment of the redirect address, and by checking in the identity platform whether the implicit grant is enabled for the client.
Remediation
Move the client to the authorisation code flow with PKCE:
- Request
response_type=code, send a PKCEcode_challengewithcode_challenge_method=S256, and exchange the code for tokens at the token endpoint with the matchingcode_verifier. Current OAuth and OpenID Connect libraries for single-page and mobile applications support this. - Where possible, use a backend-for-frontend design, in which a server-side component completes the flow and holds the tokens, and the browser receives only an
HttpOnly,Securesession cookie. - Once the change is made, disable the implicit grant for the client at the authorisation server, for example by clearing the implicit grant options in the app registration in Microsoft Entra ID, or removing the implicit grant type from the client's settings on other platforms, so it cannot be used even if requested.
- Keep access tokens short-lived and limited to the scopes the client needs.
Confirm the fix by checking that authorisation requests use response_type=code with a code challenge, that no token appears in the redirect address, and that the authorisation server refuses an implicit request for the client.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.