05Cross-Site Scripting: Filters & Bypasses
Three inputs, three filters. Work out reflected vs stored, and break out of an attribute context.
About this lab
Cross-site scripting is getting the browser to run your JavaScript in someone else's session. It matters because that script runs with the victim's privileges — it can read the page, read the session, and act as them.
The interesting part is not <script>alert(1)</script>. It is context. The same input lands differently depending on whether it is written into HTML body, into an attribute, or into a JavaScript string — and the filter in front of it usually only defends one of those.
What you will do
- Tell reflected from stored XSS by whether the payload survives a reload.
- Work out what each of the three filters strips, by testing one character at a time.
- Break out of an attribute context by closing the quote and the tag.
- Fire JavaScript without the word
script, using an event handler. - Write up which input was vulnerable, in what context, and what an attacker gains.
Where this is used
XSS is the bug that turns a low-severity "user input is reflected" note into account takeover, and the one developers most often believe they have fixed with a blocklist. Being able to demonstrate a bypass in the actual context is what gets it taken seriously.
Simulated environment — no real systems are contacted. Only ever test systems you own or are authorised in writing to test.