Skip to content
XSS Write-up Beginner

How I Found XSS by Understanding Context

A search parameter was reflected directly inside an HTML attribute value without adequate escaping, so a crafted input could break out of the attribute and tag and inject an element with an event handler. The author confirmed that arbitrary JavaScript ran in the page, including reading session cookies.

medium.com

Published on medium.com

A real-world walkthrough of methodical thinking over random payload spraying — from reflection discovery to confirmed execution.

sh3llwolf, 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 user input into an HTML attribute value without encoding the quote character or angle brackets, allowing the attribute and tag to be closed early.

Impact

Arbitrary JavaScript could be executed in the victim's browser, including reading session cookies, which the author presents as real-world severity.

What the attacker needed

Reflected search parameter; victim visits a crafted link

How it was found

  1. Enter a simple test string in the search field and inspect the page source to find where it is reflected.
  2. Note that the input lands inside an HTML attribute value.
  3. Craft input that closes the attribute quote, closes the tag, and adds a new element with an event handler.
  4. Submit it through the search parameter and observe the handler firing an alert.
  5. Try further variants to show cookie access and an iframe-based vector.

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 sometimes puts what you type back into the page. If it does that without cleaning it properly, an attacker can type extra HTML that the browser treats as real code. Here the typed text landed inside an attribute (a setting on an HTML tag), and by closing the quote and the tag the attacker could add their own element that runs JavaScript when it loads.

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.