Account Takeover via OAuth Redirect Uri Manipulation
The target's OAuth authorisation endpoint did not strictly validate the client_id and redirect_uri parameters, so an attacker could swap in their own client ID and redirect the authorisation code to a server they control. The attacker could then exchange that code for a token and take over the victim's account without knowing their password.
medium.com
Published on medium.com
Dalam dunia aplikasi web modern, OAuth telah menjadi standar untuk fitur “Social Login” (Login dengan Google, Facebook, dkk). Meskipun menawarkan kemudahan, kesalahan konfigurasi kecil dalam menangani permintaan ini dapat berdampak fatal.
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 authorisation endpoint accepted an arbitrary client_id and redirect_uri without checking them against a registered allowlist for the target application.
Impact
An attacker could take over the victim's account without credentials, reaching personal data, payment methods and purchase history, though the victim must click Allow on a consent screen for the attacker's app.
What the attacker needed
Victim clicks a crafted link; victim approves the attacker's app
The fix
The redirect URI should be strictly allowlisted per client_id, the client_id should be verified against the internal application, and a unique state parameter should be used.
How it was found
- Open the target login page and choose 'Login with Google', intercepting the outgoing GET request.
- Replace the official client_id with the attacker's own client ID and change redirect_uri to the attacker's server.
- Send the modified link to the victim, who is asked to grant access to the attacker's application.
- After the victim clicks Allow, Google sends the authorisation code to the attacker's server.
- The attacker exchanges the captured code for an access token and gains access to the victim's account.
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.
When you click 'Log in with Google', the site sends you to Google with two key values: which app is asking (client_id) and where Google should send the result (redirect_uri). If the site does not check these values properly, an attacker can point the result at their own server and receive the login code meant for you. With that code they can log in as you.
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.