XSS when clicking "Share to Twitter" at quora.com/widgets/embed_iframe?path=...
A question title containing double quotes was inserted into the href attribute of a 'Share to Twitter' button without proper escaping, allowing an attacker to inject JavaScript. When a victim clicked the button, the injected script executed in the context of the Quora page.
Originally disclosed on HackerOne
- Triaged in 2 months
- Fixed in 5 months
- Paid in 2 months
- Disclosed after 5 months
Summary:
The endpoint at https://{language}.quora.com/widgets/embed_iframe?path={path_to_answer_in_same_language} shows the answer you specify in path (like /Question/answer/User) in a format useful to embed.
There is one button Share that when clicked shows another button Share to Twitter. The href attribute of this last button is of the format javascript: window.open("https://twitter.com/intent/tweet?text=Answer on @Quora by @User to Question? http://qr.ae/nnnn", "Share Answer to Twitter", "width=600, height=250").
The problem is that you can create a question with " (quotes) and inject Javascript code that is going to be executed when the user clicks Share to Twitter.
Description (Include Impact): It requires user interaction, but it works.
Steps To Reproduce
- Go to https://www.quora.com/
- Click on Ask Question
- Enter a valid question which includes
"-alert(document.domain)-"somewhere. I enteredQuestion ignore "-alert(document.domain)-"?and it was accepted as valid - Now you may be in the page of the question you just asked
- Click on Answer
- Enter anything
- Click on Submit
- Copy the path from the address bar. Mine was
/Question-ignore-alert-document-domain/answer/Cuenta-Para-Probar - Go to
https://www.quora.com/widgets/embed_iframe?path={path_from_last_step}. Mine is https://www.quora.com/widgets/embed_iframe?path=/Question-ignore-alert-document-domain/answer/Cuenta-Para-Probar - Click on Share
- Click on Share to Twitter
alert(document.domain)is executed
Optional: Your Environment (Browser version, Device, app version, os version etc)
- It is not browser dependent. Anyway, I tested it on Firefox, Chrome and Safari for Mac.
Optional: Supporting Material/References (Screenshots)
- I don't think is necessary, but let me know if you need something else.
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 execute arbitrary JavaScript in the context of the Quora embed page when a victim clicked the share button, though user interaction was required.
What the attacker needed
Victim clicks Share then Share to Twitter; attacker can create a question with a crafted title
How it was found
- Go to Quora and click Ask Question.
- Enter a question that includes a double quote and JavaScript code, such as a quote followed by an alert.
- Answer the question and submit the answer.
- Copy the path of the answer from the address bar.
- Open the embed iframe URL with that path.
- Click Share, then click Share to Twitter; the script executes.
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.
A website sometimes puts user-supplied text into a link's address. If that text contains a double quote, it can break out of the link and add a script command. Here, a question title with a quote let the attacker add JavaScript that ran when someone clicked a share button.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.