Skip to content
OAuth / SSO Disclosed report Intermediate

Stealing Users OAuth authorization code via redirect_uri

The OAuth redirect_uri parameter allowed path traversal, so an attacker could redirect a victim's authorization code to their own product page. If the attacker had Google Analytics enabled, the code could be leaked and used to take over the victim's account.

kuzu7shiki Follow

Originally disclosed on HackerOne

Bounty$2,000 High View original
  • Triaged in 4 days
  • Fixed in 34 days
  • Paid in 20 days
  • Disclosed after 46 days

Summary:

Path traversal in OAuth redirect_uri which can lead to users authorization code being leaked to any malicious user.

The following authorization code flow request is generated at booth login.

https://oauth.secure.pixiv.net/v2/auth/authorize?client_id=a1Z7w6JssUQkw5Hid0uIDeuesue9&redirect_uri=https%3A%2F%2Fbooth.pm%2Fusers%2Fauth%2Fpixiv%2Fcallback&response_type=code&scope=read-works+read-favorite-users+read-friends+read-profile+read-email+write-profile&state=%3A1a38b53563599621ce25094661b1c4458ddb52d79d771149

Path traversal vulnerability in this redirect_uri parameter allows the attacker to direct the user to the product page created by the attacker.

redirect_uri=https%3A%2F%2Fbooth.pm%2Fusers%2Fauth%2Fpixiv%2Fcallback/../../../../ja/items/4503924

-> redirected to https://booth.pm/ja/items/4503924

If the attacker had Google Analytics enabled, the query string could be exposed when the victim is redirected to the product page, so the unused authorization code is leaked.

Steps To Reproduce:

  1. The attacker makes his shop public. Register his products and set up his Google Analytics tracking ID.
  2. Have the victim click on the following link; the value of the state parameter can be anything.
https://oauth.secure.pixiv.net/v2/auth/authorize?client_id=a1Z7w6JssUQkw5Hid0uIDeuesue9&redirect_uri=https%3A%2F%2Fbooth.pm%2Fusers%2Fauth%2Fpixiv%2Fcallback/../../../../ja/items/[attacker's product id]&response_type=code&scope=read-works+read-favorite-users+read-friends+read-profile+read-email+write-profile&state=%3A1a38b53563599621ce25094661b1c4458ddb52d79d771149
  1. When the victim clicks on the above link and proceeds with the login process, he is redirected to the attacker's product page.

  2. The attacker can steal victims' authorizaiton code from Google Analytics real-time reports.

Impact

Due to path traversal in redirect_uri parameter in OAuth flow, its possible to redirect authenticated users to attacker's product page with their OAuth credentials from which its possible to takeover their account.

Attachments

recording-1675493976118.webm From the original on HackerOne

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

Impact

An attacker could steal a victim's OAuth authorization code and potentially take over their account.

What the attacker needed

Attacker has a public shop with a product; attacker has Google Analytics enabled; victim clicks a crafted link and logs in

How it was found

  1. The attacker makes their shop public, registers products, and sets up a Google Analytics tracking ID.
  2. The attacker sends the victim a link with a crafted redirect_uri containing path traversal to the attacker's product page.
  3. The victim clicks the link and proceeds with the login process.
  4. The victim is redirected to the attacker's product page.
  5. The attacker steals the victim's authorization code from Google Analytics real-time reports.

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 another service, that service sends a secret code back to the website. The website tells the service where to send the code using a parameter called redirect_uri. Here, the website didn't check that the address stayed on its own site, so an attacker could make the code go to their own page and steal it.

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 pixiv

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.