The Day I Found a Cross-Site Scripting (XSS) Vulnerability in a B
A comments section on a web application rendered user input without escaping special characters, allowing a reflected cross-site scripting attack. An attacker could run JavaScript in a victim's browser, potentially stealing cookies or conducting phishing.
Published on medium.com
Participating in bug bounty programs has always been an exhilarating experience for me. It’s like embarking on a digital treasure hunt, where the treasures are vulnerabilities, and the rewards are not only monetary but also the satisfaction of making the internet a safer place.
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 application failed to sanitise or encode user input before inserting it into the page's HTML.
Impact
An attacker could run arbitrary JavaScript in a victim's browser, potentially stealing cookies or conducting phishing attacks.
What the attacker needed
Victim visits a crafted link or page; comments section accepts user input
The fix
The vulnerability was fixed by the company updating their security mechanisms, and the report suggested proper input sanitisation and encoding.
How it was found
- Find a comments section where user input is rendered on the page.
- Submit a simple script tag to see if it executes.
- Try variations such as an SVG with an onload handler to bypass filters.
- Observe that the input is reflected without escaping and the alert box appears.
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.
Cross-site scripting (XSS) is when a website shows user input as code instead of plain text. Here, a comment field displayed whatever was typed, so a script could run in another visitor's browser. That script could then act as the user, for example reading their cookies (small files that keep them logged in).
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.