Skip to content
XSS Write-up Beginner

Watch Out for `$` Based Third-Party Sinks

Several websites used third-party jQuery libraries that inserted user-supplied search terms into JavaScript code without proper escaping. An attacker could craft a link that executes arbitrary script in a 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 third-party jQuery libraries placed user-controlled input into JavaScript string literals without escaping single or double quotes, allowing the input to break out of the string context.

What the attacker needed

Victim clicks a crafted link; site uses vulnerable third-party jQuery library

The fix

The third-party libraries should escape or encode user-supplied input before inserting it into JavaScript string literals, or developers should avoid passing raw user input to these sinks.

How it was found

  1. Send a harmless probe string containing a double quote and a single quote in a search parameter.
  2. Observe which characters are reflected, encoded, or filtered in the page source.
  3. Craft a payload that breaks out of the JavaScript string using the unescaped quote.
  4. Load the crafted URL and confirm 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 write-up has not been written yet. The Original tab links to the source.

Some websites take what you type in a search box and put it directly into a piece of JavaScript code that runs in your browser. If the site does not clean up special characters like quotes, an attacker can add their own code. When a victim clicks a crafted link, that code runs and can do things like show a pop-up or steal data.

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.