Skip to content
OAuth / SSO Write-up Intermediate

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.

Shah kaif Follow

Published on infosecwriteups.com

By Shah kaif | “A single redirecturi = complete JWT theft.” | LinkedIn | Youtube

Shah kaif, on infosecwriteups.com

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

  1. Intercept the OAuth request when clicking the Support Ticket link.
  2. Change the redirect_uri parameter to an external domain.
  3. Observe that the application redirects to the external domain after login.
  4. Replace the redirect_uri with a Burp Collaborator server.
  5. 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.

More by Shah kaif

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

OAuth and single sign-on flaws

The lesson behind this report.

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.