Cracking a “Fortress” OAuth redirect_uri: A Deep Technical Dive
The article dissects a custom OAuth implementation in a major automotive company's identity system, explains why the redirect_uri is the critical attack surface, and details how systematic fuzzing and a double‑encoding payload ultimately bypass the strict URL validation to hijack user accounts.
SSO and OAuth Quick Start
Single Sign‑On (SSO) lets a user log in once and access multiple services; Google’s ecosystem (Gmail, YouTube, Cloud) is a classic example. Implementations vary – some rely on SAML or third‑party OAuth providers, while large enterprises often build custom SSO systems, which tend to have higher error rates.
OAuth Login Flow
Application (e.g., YouTube) redirects the user to the identity provider (e.g., Google) with parameters such as client_id, redirect_uri, scope, and state.
User authenticates at the provider.
Provider returns an authorization code (or token) to the supplied redirect_uri.
Application exchanges the code for a session cookie, token, or similar credential.
The security boundary lies in the redirect_uri. If an attacker can control its destination, they can capture the authorization code and take over the victim’s account, which is why providers validate redirect_uri strictly.
Two Redirect Types
Exchange Endpoint : Server‑side handling of the code with a 301/302 redirect; the only manipulable vector is redirect_uri.
Dispatcher Endpoint : Client‑side JavaScript processes the response; additional vectors such as state, postMessage, and Unicode differences in window.location can be exploited.
The dispatcher mode offers a broader attack surface; the author previously earned a $12,000 bounty on a similar Google product.
Target OAuth Flow
The target is a global automotive leader with a unified OAuth system driven by a self‑built identity provider. A typical authorization request looks like:
https://idp-connect.company.com/auth/api/v2/user/authorize
?client_id=dummy
&redirect_uri=https%3A%2F%2Fwww.company.com%2Fapi%2Fbin%2Fopenid%2Flogin
&state=[BASE64_STATE]
&scope=openid+profile+email+phone
&response_type=code
&ui_locales=enAfter authentication the provider redirects to:
https://www.company.com/api/bin/openid/login?code=AUTHORIZATION_CODE&state=...This is the exchange endpoint; the state parameter is a simple Base64‑encoded URL and cannot be abused.
Attack Surface Analysis
Application : www.company.com Provider : idp-connect.company.com Exchange Endpoint : https://www.company.com/api/bin/openid/login No Dispatcher Endpoint : clean 301 redirects.
state cannot be abused.
Thus the only viable path is to manipulate redirect_uri. The provider accepts sub‑domains (e.g., abc.company.com), so the challenge is to bypass its strict validation.
Fuzzing the URL Parser
Initial attempts fuzzed single characters (
