Skip to content
XSS Write-up Intermediate

From “alert(1)” to Victory: How I Bypassed My First XSS Filt

A search bar reflected user input but blocked common XSS payloads. By inserting HTML comments inside attribute names and character references, the author bypassed the filter and achieved reflected XSS, then chained it with a CSRF form to auto-submit the payload without user interaction.

ValidByAccident Follow

Published on systemweakness.com

So this one started like every other bug bounty journey — with a simple idea and a not-so-simple filter in my way.

ValidByAccident, on systemweakness.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 input filter used simple pattern matching that did not account for HTML comments or character encoding, allowing obfuscated payloads to pass.

Impact

The reflected XSS could be triggered automatically via CSRF, but the program considered reflected XSS out of scope, so no bounty was awarded.

What the attacker needed

Victim visits a crafted page; search bar reflects input

How it was found

  1. Enter a basic XSS payload in the search bar and observe it is blocked.
  2. Try splitting the alert keyword and using an anchor tag with onclick, still blocked.
  3. Add a space inside the onclick attribute name and inside alert(1), which passes the filter.
  4. Insert HTML comments inside attribute names and payloads to further obfuscate.
  5. Use a payload with HTML comments and character references to bypass the filter and trigger an alert.
  6. Create a CSRF form that auto-submits the payload in the search query, causing the alert to fire on page 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.

Cross-site scripting (XSS) is when a website shows user input as code, letting an attacker run their own script in a victim's browser. Here, the site tried to block common attack patterns, but the author found that adding HTML comments (which browsers ignore) inside the payload tricked the filter. They then used a form that submits automatically to make the attack work without the victim doing anything.

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 ValidByAccident

View all

1 more disclosed report, 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.