Skip to content
XSS Write-up Beginner

on* Landing Point

User-supplied input was reflected inside an event handler attribute without proper filtering of quotes, allowing an attacker to inject JavaScript. The author demonstrated several payloads that execute script in the victim's browser.

Ashar Javed Follow

Published on respectxss.blogspot.com

The original lives on respectxss.blogspot.com

We do not hold its text, 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 filter or encode single and double quotes in user input that was placed inside an event handler attribute.

Impact

An attacker could execute arbitrary JavaScript in a victim's browser, potentially stealing cookies or performing actions on behalf of the user.

What the attacker needed

Victim clicks a crafted link

The fix

The application should properly encode or filter user input before placing it inside event handler attributes.

How it was found

  1. Open the search URL with a harmless probe string in the searchword parameter.
  2. Observe that the probe string is reflected inside an onblur event handler and a value attribute.
  3. Inject a payload starting with a double quote to break out of the attribute and add an onmouseover handler.
  4. Alternatively, inject a payload using a single quote and JavaScript operators to execute code within the existing handler.
  5. If quotes are filtered, use HTML entity encoding for the single quote to bypass the filter.

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.

When a website puts user input directly into a page without cleaning it, an attacker can add their own code. Here the input landed inside a JavaScript event handler, so adding a quote and some script made the browser run it. This is called cross-site scripting (XSS).

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by Ashar Javed

View all

14 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.