Skip to content
XSS Write-up Beginner

How I found XSS on NIT website

A search field on a portal reflected user input inside a page title element without proper encoding, so a crafted search term could break out of the title and run script. An attacker could use this to steal a visitor's session cookie or alter the page content.

medium.com

Published on medium.com

So the story is that I was just surfing through random websites I found using dorks. It wasn’t even exciting as I was doing bug bounty for past 12 hours and was really frustrated.

StvRoot, 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 search input was reflected into the page's title element without encoding, allowing the closing title tag to be injected.

Impact

The reflected script could read the victim's cookie and redirect them, and could also be used to deface the page.

What the attacker needed

Victim opens a crafted link

How it was found

  1. Find the portal and open its search feature.
  2. Submit a simple script test and observe it is filtered.
  3. Inspect the page source to see where the input lands.
  4. Craft input that closes the title element and adds a script to read the cookie.

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, an attacker can type code instead of normal text and the browser will run it. That is called cross-site scripting, and it lets the attacker act as the logged-in user, for example by reading their session cookie.

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.