Skip to content
OAuth / SSO Disclosed report Beginner

Possible to redirect to a (non-existing) subdomain after logging in via GitHub (leaking the token)

The OAuth redirect_uri whitelist allowed redirects to subdomains of the target domain, including non-existent ones. If a subdomain is vulnerable, the login token could potentially be stolen.

jackds Follow

Originally disclosed on HackerOne

High 8.8 View original
  • Triaged in under an hour
  • Fixed in 1 hour
  • Disclosed after 21 hours

Summary

To comment on an article a user has the option to login using his Github account. After logging in the user is normally redirect back to the URL he came from. I found out that it is also possible to redirect to a non-existing subdomain of edoverflow.com. It looks like the whitelist for the OAuth flow is not configured properly.

Vulnerability Details

For logging in using the OAuth login flow the following URL is used: https://github.com/login/oauth/authorize?client_id=5f45cc999f7812d0b6d2&redirect_uri={url}&scope=public_repo . The redirect_uri parameter is matched against the configured URLs in the OAuth Application settings. I'm not sure how this is configured for this app, but it seems possible to redirect to a subdomain as well.

Steps To Reproduce:

  1. Go to https://github.com/login/oauth/authorize?client_id=5f45cc999f7812d0b6d2&redirect_uri=https%3A%2F%2Fnonexisting.edoverflow.com&scope=public_repo
  2. Login using your Github account
  3. You are now redirected to nonexisting.edoverflow.com?code={code}

Impact

Impact is limited as it is still only possible to redirect to a subdomain. In order to carry out an attack the attackers needs to find a vulnerable subdomain first.

Supporting Material/References

Impact

If the target URL is vulnerable in any way the attacker might be able to actually steal a login-token.

The original report as published on HackerOne, by jackds. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the OAuth application's redirect_uri whitelist was configured to allow any subdomain of the target domain rather than exact URLs.

Impact

Impact is limited because the attacker must first find a vulnerable subdomain, but if one exists they could steal the login token.

What the attacker needed

A GitHub account; attacker controls a subdomain of the target

How it was found

  1. Visit the GitHub OAuth authorisation URL with a redirect_uri pointing to a non-existent subdomain.
  2. Log in using a GitHub account.
  3. Observe the redirect to the non-existent subdomain with the authorisation code in the query string.

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 report has not been written yet. The Original tab links to the source.

When you log in with GitHub, the site sends you back to a pre-approved address. Here, the approval list was too loose and accepted any subdomain, even one that does not exist. If an attacker can control such a subdomain, they could intercept the login code.

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 jackds

View all

6 more disclosed reports, best first.

More from Ed

View all

The newest disclosed reports for this program.

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.