Skip to content
XSS Write-up Beginner

Reflected XSS — Part 2

The email parameter on a password-reset page was reflected unencoded inside a script block, so a crafted value could break out of the JavaScript string and run arbitrary code. An attacker could use this to execute script in a victim's browser via a crafted reset link.

file_d0t_bug Follow

Published on medium.com

Hey I am Ruba Khaled (file.bug) ,I found a reflected XSS in a public bug bounty program inside a password-reset page. This is part 2 of my XSS journey — read part 1 here:

file.bug, 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 email parameter was inserted into a JavaScript string inside a script block without JavaScript-aware encoding or escaping.

Impact

An attacker could run arbitrary JavaScript in a victim's browser through a crafted password-reset link, though the text does not show any specific harm beyond a popup.

What the attacker needed

Victim clicks a crafted reset link; attacker can craft the email parameter

How it was found

  1. Go through the password-reset flow and request a reset email.
  2. Follow the reset link and inspect the page source.
  3. Check the token parameter and note that only alphabetical characters are reflected and the double quote is blocked.
  4. Check the email parameter and see that it is reflected in the source.
  5. Inject a value containing a double quote and observe it is reflected inside a script tag.
  6. Use a payload that closes the string and parenthesis, runs script, and comments out the rest of the line.

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 reflected cross-site scripting (XSS) bug happens when a website takes something you typed or clicked and puts it straight into the page without cleaning it up. Here the email address from a password-reset link was placed inside a piece of JavaScript code, so an attacker could put special characters in the link that make the browser run their own script. That script could then act as the victim on the site.

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.