# Common OAuth Vulnerabilities

DevFeed: [Common OAuth Vulnerabilities](<https://devfeed.tech/articles/common-oauth-vulnerabilities-92058.md>)

Original publisher: [Read original article](<https://blog.doyensec.com/2025/01/30/oauth-common-vulnerabilities.html>)

Author: Authorization Code Flow

Published: 2025-01-29T23:00:00Z

Content type: article

Language: en

Sources: [Doyensec](<https://devfeed.tech/sources/doyensec.md>)

Topics: [OAuth 2.0](<https://devfeed.tech/topics/oauth2.md>), [OAuth](<https://devfeed.tech/topics/oauth.md>), [pkce](<https://devfeed.tech/topics/pkce.md>), [Server-side vs Client-side OAuth2 Flows](<https://devfeed.tech/topics/server-side-vs-client-side-oauth2-flows.md>), [OpenID connect (OIDC)](<https://devfeed.tech/topics/oidc.md>), [XSS](<https://devfeed.tech/topics/xss.md>)

Tags: [access-tokens](<https://devfeed.tech/tags/access-tokens.md>), [attacks](<https://devfeed.tech/tags/attacks.md>), [auditing](<https://devfeed.tech/tags/auditing.md>), [auth0](<https://devfeed.tech/tags/auth0.md>), [authorization](<https://devfeed.tech/tags/authorization.md>), [automation](<https://devfeed.tech/tags/automation.md>), [browser](<https://devfeed.tech/tags/browser.md>), [client](<https://devfeed.tech/tags/client.md>), [credentials](<https://devfeed.tech/tags/credentials.md>), [developers](<https://devfeed.tech/tags/developers.md>), [doyensec](<https://devfeed.tech/tags/doyensec.md>), [doyensecurity](<https://devfeed.tech/tags/doyensecurity.md>), [end-user](<https://devfeed.tech/tags/end-user.md>), [exploit](<https://devfeed.tech/tags/exploit.md>), [flow](<https://devfeed.tech/tags/flow.md>), [guide](<https://devfeed.tech/tags/guide.md>), [hacking](<https://devfeed.tech/tags/hacking.md>), [hosting](<https://devfeed.tech/tags/hosting.md>), [html](<https://devfeed.tech/tags/html.md>), [https](<https://devfeed.tech/tags/https.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [infosec](<https://devfeed.tech/tags/infosec.md>), [oauth](<https://devfeed.tech/tags/oauth.md>), [oauth-2-0](<https://devfeed.tech/tags/oauth-2-0.md>), [oauth2](<https://devfeed.tech/tags/oauth2.md>), [offensive](<https://devfeed.tech/tags/offensive.md>), [pentest](<https://devfeed.tech/tags/pentest.md>), [pentester](<https://devfeed.tech/tags/pentester.md>), [protocol](<https://devfeed.tech/tags/protocol.md>), [reverse-engineering](<https://devfeed.tech/tags/reverse-engineering.md>), [security](<https://devfeed.tech/tags/security.md>), [vulnerabilities](<https://devfeed.tech/tags/vulnerabilities.md>), [vulnerability](<https://devfeed.tech/tags/vulnerability.md>)

## AI overview

The article explains that OAuth flaws often arise when implementations mishandle flow assumptions, redirects, tokens, or user identity. It contrasts the discouraged Implicit Flow, which can expose access tokens to the user agent, with Authorization Code Flow, which keeps tokens in the client and requires securely stored credentials, and PKCE, which binds code exchange to a verifier and is recommended for apps unable to keep a client secret. It also describes machine-to-machine, device authorization, and password credential flows, noting the latter is removed from OAuth 2.1 and not recommended. Covered attacks include CSRF (mitigate with `state`), weak `redirect_uri` checks (compare exact URI), mutable identity claims (use immutable `sub` rather than unverified email), client confusion (validate token client ID and reject user-supplied tokens), scope upgrades (check requested scope), and mobile redirect hijacking (use PKCE and verified links where applicable).

## Source excerpt

OAuth2's popularity makes it a prime target for attackers. While it simplifies user login, its complexity can lead to misconfigurations that create security holes. Some of the more intricate vulnerabilities keep reappearing because the protocol's inner workings are not always well-understood. In an effort to change that, we have decided to write a comprehensive guide on known attacks against OAuth implementations. Additionally, we have created a comprehensive checklist. It should prove useful for testers and developers alike to quickly assess whether their implementation is secure. Download the OAuth Security Cheat Sheet Now! Doyensec_OAuth_CheatSheet.pdf. OAuth Introduction OAuth Terminology OAuth is a complex protocol with a many actors and moving parts. Before we dive into its inner workings, let's review its terminology: Resource Owner: Entity that can grant access to a protected resource. Typically, this is the end-user. Client: Application requesting access to a protected resource on behalf of the Resource Owner. Resource Server: Server hosting the protected resources. This is the API you want to access. Authorization Server: Server that authenticates the Resource Owner and issues Access Tokens after getting proper authorization. For example, Auth0. User Agent: Agent used by the Resource Owner to interact with the Client (for example, a browser or a native application). References OAuth 2.0 RFC: https://datatracker.ietf.org/doc/html/rfc6749 OAuth Terminology: #oauth-2-0-terminology OAuth Common Flows Attacks against OAuth rely on challenging various assumptions the authorization flows are built upon. It is therefore crucial to understand the flows to efficiently attack and defend OAuth implementations. Here's the high-level description of the most popular of them. Implicit Flow The Implicit Flow was originally designed for native or single-page apps that cannot securely store Client Credentials. However, its use is now discouraged and is not included in the OA