Skip to content
OAuth / SSO Write-up Intermediate

Stealing 0Auth Token (MITM)

The OAuth redirect_uri validation accepted any scheme and any subdomain under the connect host, so an attacker could point the callback at a plain-HTTP subdomain that lacked HSTS. The authorisation code was then sent over HTTP, allowing a man-in-the-middle to steal it.

Arbaz Hussain Follow

Published on medium.com

{{media:0}}

Arbaz Hussain, on medium.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 redirect_uri validation only checked the host suffix and allowed arbitrary schemes, and the target subdomain did not enforce HSTS.

Impact

An attacker on the network could intercept the OAuth authorisation code sent over HTTP, though the program treated man-in-the-middle attacks as out of scope.

What the attacker needed

Victim uses the OAuth flow; attacker on the same network; HTTP subdomain without HSTS

The fix

The redirect_uri was restricted to a strict path, and the report recommends enforcing HSTS with includeSubDomains.

How it was found

  1. Try the OAuth flow with a modified redirect_uri using a different scheme and a pre-subdomain under connect.
  2. Brute-force pre-subdomains under connect and find a static page subdomain.
  3. Check the headers of that subdomain and notice HSTS is missing.
  4. Send the OAuth request with redirect_uri set to the HTTP version of that subdomain.
  5. Observe the authorisation code arriving over HTTP.

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.

When you log in with a third-party account, the site sends you back to a callback address after login. If that address is not strictly checked, an attacker can make it point at a page they control or at an insecure HTTP page. Here the callback could use HTTP on a subdomain without HSTS, so someone on the network could read 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 Arbaz Hussain

View all

14 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.