Uncovering a Stored XSS Vulnerability on Drugs.com
A stored cross-site scripting flaw existed in the question-asking feature on Drugs.com, allowing an attacker to inject a script that would execute in any user's browser when the question was viewed. The attacker could run arbitrary JavaScript in the context of the victim's session.
medium.com
Published on medium.com
I want to highlight a Stored Cross-Site Scripting (XSS) vulnerability recently discovered on Drugs.com by fellow researcher Mathara. This vulnerability allows attackers to inject malicious scripts that execute in users’ browsers.
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 question field was saved and later displayed without proper output encoding or sanitisation, so HTML tags and event handlers were treated as active content.
Impact
An attacker could execute scripts in the context of any user’s browser who viewed the stored question, potentially leading to session compromise or other client-side attacks.
What the attacker needed
Ability to submit a question on Drugs.com; victim views the stored question
The fix
The vulnerability was resolved according to the report status.
How it was found
- Go to the Drugs.com Ask page.
- Enter a crafted iframe with an onload handler in the question field.
- Submit the question.
- Observe the alert showing the document domain.
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.
Stored cross-site scripting (XSS) happens when a website saves something a user types, like a question, and later shows it to other people without cleaning it up. If the saved text includes code, the browser runs that code as if the website itself had written it, which can let an attacker do things like read the victim's data or act as them.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.