Skip to content
OAuth / SSO Disclosed report Intermediate

Stealing Users OAUTH Tokens via redirect_uri

The OAuth redirect_uri validation only checked that the URL started with the legitimate domain, not that it ended correctly, allowing an attacker to craft a URL that redirects to a malicious domain. An attacker could steal OAuth tokens and take over accounts.

ethancruize Follow

Originally disclosed on HackerOne

  • Fixed in 3 days
  • Disclosed after 10 days

Hi, I would like to report an Open redirection on oauth redirect_uri which can lead to users oauth tokens being leaked to any malicious user.

Detail

During the OAUTH flow, the redirect_uri on https://accounts.bistudio.com is not properly validating that the URL given is proper, as such a bypass of filter is possible and hence thereby able to exfiltrate users oauth tokens to that nonexisting domain.

On clicking on Login on https://xbox.dayz.com an OAUTH request is triggered to accounts.bistudio.com, the endpoint is checking if the Redirect_uri is starting with https://xbox.dayz.com and not checking the ending bits, as such its possible to inject anything after that.

As an example i injected https://xbox.dayz.comtest.com and the server's whitelist is bypasses and a redirect is performed to https://xbox.dayz.comtest.com with the code and state values.

Steps to Reproduce

  • Login to any website in the scope
  • After Login access the following URL -
https://accounts.bistudio.com/api/auth?response_type=code&redirect_uri=http%3A%2F%2Fxbox.dayz.comtest.com%2Fapi%2Fauth%2Fcallback&state=OCoU2LvhmzLGAZ03DWem5QNs&client_id=%24edd1bfdc470df4b8d7b81c2683fc6d3
  • On accessing you will get redirected to xbox.dayz.comtest.com with oauth access code and state, registering such domain is possible and when any loggedin user accesses the URL its possible to steal their oauth creds.

RAW Request

GET /api/auth?response_type=code&redirect_uri=http%3A%2F%2Fxbox.dayz.comtest.com%2Fapi%2Fauth%2Fcallback&state=OCoU2LvhmzLGAZ03DWem5QNs&client_id=%24edd1bfdc470df4b8d7b81c2683fc6d3 HTTP/1.1
Host: accounts.bistudio.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://incubator.bohemia.net/
Cookie: cookieconsent_dismissed=yes; bi.accounts.connect.sid=s%3AEbOE7LAPYR9IJO8ocyKuhNoIx_qXNt7_.UWaqiLeZPbgCSPM5nTvWUY2HiRYUXzEjw%2BRPxP3optA; bi_store_auth_session=eyJpdiI6IkcxSWloOVwvdngyaVFjZE9WM012ZzZMRmpkY1VnN1wvOW5abnkyYlNBVklaMD0iLCJ2YWx1ZSI6IjRpUFRUNzFkNElkWkZWeUc4U2o1TkNBaytURlJnVEVyaVFlMTJEc1pjcFR6XC9wUjlHdjd2cDRNQXFaN3hlZjVodHFMaW84WVFxWVJvUG1DOE4xTmtqUT09IiwibWFjIjoiZmRkZThlYjliMmZhMjc4YzBhMWVjMThkN2UxOTc5NmY3MjQ1YTc0NGFlY2FmNGVlNDUwOTU4ZjZmMGU5YTMwMSJ9
Connection: close
Upgrade-Insecure-Requests: 1

Impact

Due to validation bypass in redirect_uri parameter in OAUTH flow, its possible to redirect authenticated users to arbitrary domains with their oauth credentials from which its possible to takeover their account.

Best Regards, EC

Attachments

oauth.PNG
oauth.PNG From the original on HackerOne

The original report as published on HackerOne, by ethancruize. 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

The OAuth server validated the redirect_uri by checking only that it started with the allowed domain, without verifying the full domain or path, allowing a crafted domain like xbox.dayz.comtest.com to pass.

Impact

An attacker could redirect authenticated users to an arbitrary domain and steal their OAuth credentials, potentially leading to account takeover.

What the attacker needed

Victim is logged in; attacker registers a lookalike domain; victim clicks a crafted link

The fix

The redirect_uri validation should be strengthened, for example by exact matching or validating the full domain and path.

How it was found

  1. Log in to any website in scope.
  2. Access the OAuth authorization URL with a crafted redirect_uri pointing to a domain that starts with the legitimate domain.
  3. The server redirects to the attacker-controlled domain with the OAuth code and state.
  4. Register the malicious domain and trick a logged-in user into visiting the URL to steal their OAuth credentials.

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 using another service (like 'Log in with Xbox'), that service sends you back to the original website with a special code. The website checks where it is sending you back to, but it only checked the beginning of the address, not the end. So an attacker could make a similar-looking address that actually belongs to them and steal your 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 from BOHEMIA INTERACTIVE a.s.

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.