Stealing JWT Tokens via OAuth redirect_uri Manipulation: A Critic
The OAuth flow did not validate the redirect_uri parameter, so an attacker could redirect the authentication response to any domain. Because the JWT token was returned in the URL fragment, an attacker could steal it and take over the victim's account.
By Shah kaif | “A single redirecturi = complete JWT theft.” | LinkedIn | Youtube
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 did not validate the redirect_uri against a whitelist and returned the JWT in the URL, allowing token leakage to any domain.
Impact
An attacker could steal the JWT token of any authenticated user who clicks a malicious link, leading to account takeover.
What the attacker needed
Victim is authenticated on app.domain.com; victim clicks a malicious OAuth link
The fix
The vulnerability was fixed by properly validating the redirect_uri and not exposing tokens in URLs.
How it was found
- Intercept the OAuth request when clicking the Support Ticket link.
- Change the redirect_uri parameter to an external domain.
- Observe that the application redirects to the external domain after login.
- Replace the redirect_uri with a Burp Collaborator server.
- Forward the request and observe the JWT token in the Collaborator interactions.
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. The redirect_uri tells the service where to send you after login. If the service does not check that address, an attacker can make it send the login token to their own site, letting them 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.