Skip to content
XSS Write-up Beginner

How I Found My First (Unethical) Bug

Two greeting-card websites reflected and stored user-supplied names and comments without properly sanitising HTML, so an attacker could inject an image tag with an error handler that ran script in visitors' browsers. The author used this to pop alert boxes on both sites, including in the comment dashboard of the second site.

thatcyberboy Follow

Published on medium.com

Hey hackers, I’m Akash Vishwakarma aka thatcyberboy, a BCA final-year student and an aspiring ethical hacker. This is my first write-up, and instead of sharing something complex, I want to tell you the story of how I found my very first vulnerability — and the mistake that came with it.

Thatcyberboy, 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 accepted HTML input and relied on a blacklist that only stripped script tags, leaving other tags and their event-handler attributes intact.

Impact

Script supplied by an attacker could run in the browser of anyone viewing a crafted greeting or the owner's comment dashboard, though the write-up only demonstrates an alert box.

What the attacker needed

No permission obtained; victim opens a crafted link or dashboard

How it was found

  1. Open the greeting site and enter a name so the URL gains a name parameter.
  2. Try a script tag payload in the parameter and observe it is filtered.
  3. On the second site, create a greeting and post a comment containing an image tag with an error handler.
  4. Open the dashboard and see the alert fire, confirming stored execution.
  5. Return to the first site and put the same image payload in the URL parameter to see it execute on load.

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 that puts whatever you type back onto the page can be tricked into running code if it does not clean the input properly. Here the site blocked the obvious script tag but forgot that an image tag with an error handler can also run JavaScript. That let the author make a pop-up appear for anyone who loaded the page.

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.