Skip to content
XSS Write-up Intermediate

The Magic of Connecting The Dots

The search page reflected the keyword parameter into a JavaScript string without escaping backslashes, and the code that would execute the reflection was gated behind a check for 'cm_kws' in the URL. By adding that string to the URL, an attacker could execute arbitrary JavaScript 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 escaped double quotes but not backslashes when embedding the keyword into a JavaScript string, and the reflection was only reached when the URL contained 'cm_kws'.

Impact

An attacker could execute arbitrary JavaScript in a victim's browser, though a WAF blocked some payloads and bypasses were shown.

What the attacker needed

Victim clicks a crafted link

How it was found

  1. Open the search URL with a keyword containing a double quote and backslash to see the reflection.
  2. Observe that backslashes are not escaped in the JavaScript string.
  3. Craft a payload that uses a backslash to neutralise the quote escaping and injects a confirm call.
  4. Notice the conditional check for 'cm_kws' prevents execution.
  5. Append 'cm_kws' to the URL to make the condition true.
  6. Load the final URL and see the confirm box.

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.

A website took what you typed in a search box and put it into a script on the page without properly handling backslash characters. By crafting a special search link, an attacker could make the site run their own JavaScript code in a visitor's browser, which 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.