Insufficient Redirect URI validation: The risk of allowing to dynamically add arbitrary query parameters and fragments to the redirect_uri
Several OAuth 2.0 identity providers insufficiently validate the redirect_uri parameter, allowing attackers to inject arbitrary query parameters or fragments. This can lead to HTTP parameter pollution, potentially enabling login CSRF where a victim is logged into an attacker-controlled account.
Published on security.lauritz-holtmann.de
In this post, I will discuss an OAuth 2.0 and OpenID Connect 1.0 implementation flaw pattern that was or is present even in well-known implementations from Github, Stackoverflow and Microsoft.
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
Impact
At worst, this could enable login CSRF, where the victim is logged into an attacker-controlled account, but this is limited if state or PKCE is used.
What the attacker needed
Victim clicks a link; victim logs in at identity provider; service provider uses first code parameter
The fix
Authorization servers should strictly validate the redirect_uri by comparing it exactly to pre-registered values, disallowing any additional query parameters or fragments.
How it was found
- Craft an authorization request with a redirect_uri that includes an extra code parameter.
- Victim clicks the link and logs in at the identity provider.
- The identity provider redirects to the service provider with both the injected code and the real code.
- The service provider may process the first code parameter, leading to login CSRF.
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 websites to let you log in using another service, like GitHub. When you log in, the service sends you back to the website with a special code. If the service doesn't check the return address carefully, an attacker can sneak in extra parameters that might confuse the website and log you into the wrong 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.