Skip to content
XSS Write-up Beginner

My first valid XSS

A reflected XSS existed because the URL path was inserted into an HTML comment at the end of the page source without sanitisation. An attacker could close the comment and inject a script tag, which executed in the victim's browser.

Jatin Aesthetic Follow

Published on medium.com

Bounty$100 View original

{{media:0}}

Jatin Aesthetic, 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 reflected the URL path into an HTML comment without encoding or validation, allowing the comment to be closed and arbitrary markup injected.

Impact

An attacker could execute arbitrary JavaScript in a victim's browser on any page of that domain, though the text does not describe any specific harm beyond the alert.

What the attacker needed

Victim visits a crafted URL

How it was found

  1. Find an endpoint where the URL path appears in the page source.
  2. View the source and notice the path is inside an HTML comment.
  3. Enter a closing comment sequence followed by a test tag in the URL path.
  4. Confirm the comment closes and the test tag is inserted.
  5. Add a script tag after the closing sequence to execute JavaScript.

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 you visit a web page, the server sends back HTML, the code that tells your browser what to show. Here, the site copied part of the web address into a hidden comment in that HTML. Because it did not clean up the text first, an attacker could add special characters that ended the comment and then add their own script, which the browser would run.

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 Jatin Aesthetic

View all

4 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.