Skip to content
XSS Write-up Beginner

Finding Reflected XSS Through Persistence

A campaign name parameter on a payment page was reflected inside an existing script tag without proper escaping. An attacker could craft a link that, when opened by a victim, would execute arbitrary JavaScript in the victim's browser and potentially steal session cookies.

alyhsan.x Follow

Published on medium.com

Today I want to share a bug bounty experience with you — a Reflected XSS I found on a public program (referred to here as redacted.com).

Ali Hassan, on medium.com

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 inserted user input into a JavaScript context without proper escaping or encoding, allowing the input to break out of the script block.

Impact

An attacker could send a crafted link to a logged-in user and potentially access that user's cookies (session data) because they were not protected with the HttpOnly flag.

What the attacker needed

Victim clicks a crafted link; victim is logged in

How it was found

  1. Open the payment page and locate the campaign name parameter.
  2. Try a basic script payload and observe that it does not execute because the input is inside an existing script tag.
  3. View the page source to confirm the input is placed inside a script block.
  4. Craft a payload that closes the existing script tag and opens a new one with the alert code.
  5. Send the crafted URL and observe the alert popup, confirming reflected XSS.

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 takes something you type (like a campaign name) and puts it directly into the page's code without cleaning it, an attacker can type special characters that break out of the existing code and add their own. Here, the input was placed inside a script block, so the attacker first closed that block and then added a new one with malicious code. This lets the attacker run their own JavaScript in the victim's browser, which can steal cookies or do other harmful things.

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.