OSWA · Module 5
Cross-Site Scripting: Exploitation
Turn XSS into session theft, credential capture, and admin takeover, and bypass filters and CSP to land working payloads.
~2.5 h 5 resources Last updated September 27, 2026
Once XSS is confirmed, exploitation turns script execution into real impact: stealing session cookies, hijacking authenticated sessions, capturing credentials, keylogging, or making authenticated requests on the victim's behalf. On the OSWA exam, emulated users visit pages at intervals, so a stored or reflected payload aimed at an admin can hand you an authenticated administrator session, the primary exam objective. This module also covers bypassing the filters and CSP that stand between a confirmed injection and a working payload.
XSS Exploitation Techniques
Each XSS type has its own exploitation path. Reflected XSS is delivered via a crafted URL to a target user. Stored XSS fires automatically when a victim (or emulated user) views the poisoned page, making it ideal for admin session theft. DOM-based exploitation abuses client-side sinks, postMessage, and client-side routing, and can chain through prototype pollution or mutation XSS to defeat sanitizers like DOMPurify.
Payloads and Filter Bypass
The JavaScript you run determines the impact: cookie and localStorage theft, page content exfiltration, authenticated requests, or loading an external payload. When input is filtered, you need tag and event-handler alternatives, context escapes, encoding chains, polyglots, and WAF-specific tricks. Content Security Policy often blocks the obvious payload, so JSONP abuse and other CSP bypasses become necessary to land execution.
Read
The core material for this module. Where a guide goes deeper than needed, the relevant sections are highlighted.
-
Guide 5 min readDOM-Based XSS ExploitationFocus on #Hash-Based Payloads #postMessage Exploitation #Origin Validation Bypasses #Client-Side Routing Abuse #React Router #Angular Router #Vue Router #Bypassing Client-Side Sanitization #DOMPurify Misconfiguration #Mutation XSS (mXSS) #Prototype Pollution to Disable Sanitizers #Cookie Theft and Session Hijacking
-
Guide 2 min readXSS Filter BypassFocus on #Tag and Event Handler Alternatives #Attribute Injection #JavaScript Context Escapes #Encoding Tricks #HTML Entity Encoding #Unicode Escapes #URL Encoding and Double Encoding #Null Byte Injection #Case Variation and Concatenation #Polyglot Payloads #WAF-Specific Bypasses #HTTP Parameter Pollution #Content-Type Mismatch #Request Method Switching
Practice
Apply the module hands-on.
- Google XSS Game Standalone Training
- Web Security Academy - Cross-Site Scripting PortSwigger Mixed (Apprentice to Expert)
- Alert HackTheBox Easy
- Headless HackTheBox Easy
- Intro to Cross-site Scripting TryHackMe Easy
- Pentester Lab: XSS and MySQL FILE Vulnhub Easy
- Sea HackTheBox Easy
- XSS TryHackMe Easy
- Clipper Proving Grounds Intermediate
- IClean HackTheBox Medium
- Imagery HackTheBox Medium
- BlockSynergy HackTheBox Insane