Skip to content
XSS Write-up Intermediate

An XSS Story

A reflected cross-site scripting vulnerability existed in a JavaScript context where double quotes were not escaped, allowing an attacker to inject JavaScript code that executes in the victim's browser.

swissky Follow

Published on swisskyrepo.github.io

Last night I stumbled across an XSS in a bug bounty program, this was quite fun to exploit.

Swissky's adventures into InfoSec World !, on swisskyrepo.github.io

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

Impact

An attacker could execute arbitrary JavaScript in a victim's browser, potentially leading to session hijacking or other client-side attacks.

What the attacker needed

Victim clicks a crafted link

How it was found

  1. Identify a URL parameter that is reflected inside a JavaScript tag.
  2. Test with a payload containing a double quote to see if it is escaped.
  3. Observe that the double quote is not escaped, allowing breaking out of the string.
  4. Craft a payload that uses the unescaped double quote to inject JavaScript code.
  5. Bypass parenthesis filtering by using backticks to call alert.
  6. Confirm the alert executes in the browser.

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 a bug where a website puts user input into a page without properly cleaning it, so an attacker can make the site run their own JavaScript code. Here, the input was placed inside a script tag, and the double quote character was not escaped, letting the attacker break out of the string and run code like alert(1).

What is XSS?

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

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.