XSS on OAuth authorize/authenticate endpoint
The OAuth authorize/authenticate endpoint did not sanitise the oauth_callback parameter, allowing an attacker to inject HTML and script into the redirection page. An attacker could execute arbitrary JavaScript in the victim's browser after they authorised an application.
Originally disclosed on HackerOne
- Triaged in 7 days
- Fixed in 12 days
- Paid in 9 days
- Disclosed after 3 months
Summary by the researcher
Write-up: https://blog.innerht.ml/csp-2015/
The report
Hi, I would like to report an issue where certain endpoints on twitter.com and api.twitter.com is vulnerable to XSS.
##Detail The redirection page after authorization/authentication does not sanitize the oauth_callback parameter.
##PoC
- Go to http://innerht.ml/pocs/twitter-oauth-xss (Please use IE or something that hasn't implemented CSP)
- Click on Authorize app
- Alert pops up
Note: it also affects api.twitter.com as they both have the same endpoints
##Repo step
- Obtain the request token (https://api.twitter.com/oauth/request_token) where parameter oauth_callback contains HTML like
javascript%3A%2F%2F"><script>alert(document.domain)</script> - Redirect the victim to the authorize/authenticate page with the token
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 run script in the victim's browser on twitter.com or api.twitter.com after the victim authorised the app, but the proof of concept only worked in browsers without CSP, such as Internet Explorer.
What the attacker needed
Victim uses a browser without CSP; victim clicks Authorize app
How it was found
- Obtain a request token with an oauth_callback parameter containing HTML/JavaScript.
- Redirect the victim to the authorize/authenticate page with that token.
- The victim clicks Authorize app.
- An alert pops up, showing script execution.
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 to a website using another service (like Twitter), the service asks you to approve the app and then sends you back to the app's website. The address to return to is given in a parameter called oauth_callback. The site failed to clean this parameter, so an attacker could put code in it that runs in your browser when you are sent back.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.