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.
Originally disclosed on HackerOne
- 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:
- The attacker makes his shop public. Register his products and set up his Google Analytics tracking ID.
- 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
-
When the victim clicks on the above link and proceeds with the login process, he is redirected to the attacker's product page.
-
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
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
- The attacker makes their shop public, registers products, and sets up a Google Analytics tracking ID.
- The attacker sends the victim a link with a crafted redirect_uri containing path traversal to the attacker's product page.
- The victim clicks the link and proceeds with the login process.
- The victim is redirected to the attacker's product page.
- 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.