Lab 08: Advanced XSS — Filter Bypass & Stored

Objective

Bypass XSS filters and exploit three XSS variants against a live API from Kali Linux:

  1. Filter bypass — the app blocks <script> literally; bypass using <ScRiPt>, <img onerror>, <svg onload>, and attribute injection

  2. Stored XSS — inject a persistent payload into the comments database that executes for every future visitor

  3. DOM XSS — exploit a reflected parameter that would be passed to document.write() in a browser

  4. Open redirect chaining — combine an open redirect with XSS for CSP bypass scenarios


Background

XSS remains in the OWASP Top 10 despite being well-understood because developers continually implement incomplete sanitisation — blocking specific strings while leaving dozens of bypass vectors open.

Real-world examples:

  • 2018 British Airways breach — stored XSS injected into a third-party widget (Modernizr); the skimming script executed on the payment page for 500,000 customers over 15 days. ICO fined £20M.

  • 2020 Twitter — stored XSS in the TweetDeck client allowed account hijacking via self-retweeting payloads. Spread virally to 38,000 accounts before the endpoint was taken down.

  • 2010 Samy worm — MySpace stored XSS spread to 1M profiles in 20 hours via a self-propagating friend-add payload. The first major XSS worm.

  • 2021 Twitch — DOM XSS in stream overlay editor; attacker-controlled URL parameter fed directly into innerHTML without sanitisation.

OWASP: A03:2021 Injection (XSS subtype)


Architecture

Time

40 minutes


Lab Instructions

Step 1: Setup


Step 2: Launch Kali and Test the Filter

📸 Verified Output:


Step 3: Stored XSS — Persistent Payload

📸 Verified Output:


Step 4: DOM XSS Exploitation


Step 5: Open Redirect for Filter Bypass


Step 6–8: Comprehensive Payload Reference + Cleanup


Remediation

Further Reading

Last updated