How I Found a Critical OAuth Misconfiguration That Led to Account Takeover
The OAuth implementation allowed unauthenticated client registration with arbitrary redirect URIs and processed authorization requests without authentication, enabling an attacker to obtain a victim's authorization code and exchange it for tokens. This led to full account takeover.
Published on medium.com
While testing a self-hosted platform during a bug bounty engagement, my teammate Kazi Sabbir and I discovered a series of OAuth misconfigurations that could be chained together to achieve full account takeover of authenticated users.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the OAuth server lacked authentication on the authorization endpoint and allowed open client registration with arbitrary redirect URIs, and did not enforce client authentication for token exchange.
Impact
Successful exploitation resulted in full account takeover, allowing the attacker to access the victim's profile, projects, and APIs, and to maintain access via refresh tokens.
What the attacker needed
Victim clicks a link; victim is logged in; victim approves OAuth request
The fix
The text does not state that the issue was fixed; it recommends authenticating OAuth client registration, validating redirect URIs, enforcing authentication on authorization endpoints, strengthening client validation, restricting CORS, and monitoring OAuth abuse.
How it was found
- Register a malicious OAuth application with an attacker-controlled callback URL.
- Generate a PKCE challenge and verifier.
- Create an authorization URL with the attacker's client ID and redirect URI.
- Send the link to a victim; if logged in, they see a consent screen.
- Victim approves, and the authorization code is sent to the attacker's callback.
- Exchange the code for tokens at the token endpoint.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
OAuth is a way for apps to let you log in using another service, like 'Sign in with Google'. The server here had several mistakes: anyone could create a fake app, and it would give out login codes without checking if the user was really logged in. An attacker could trick a victim into approving a fake app, steal the code, and get into their account.
What is OAuth / SSO?
Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.