Lab: Reflected XSS in a Java Script URL with some characters blocked
Summary: PortSwigger's lab reflects user input into a JavaScript URL while blocking certain characters to prevent XSS, and the solution requires calling alert with the string 1337 in the message. The exploit uses exception handling: a throw statement separated by a blank comment to work around the no-spaces restriction, with alert assigned to the onerror handler and an arrow function assigned to window's toString property to trigger a string conversion.
What you should know: Character blocklists are a common XSS defense, and this lab shows they can be bypassed using language features like exception handling and arrow functions rather than the blocked characters themselves.
Read the original at PortSwigger Research ↗
- Topics
- Vulnerabilities & Patching
- Related
- Attackers Exploit UnrealIRCd Flaw That Enables Server-Level Command Injection Cyber Risks · Nov 14, 2026U.S. CISA adds Check Point and UnrealIRCd flaws to its Known Exploited Vulnerabilities catalog Cyber Risks · Nov 14, 2026PostgreSQL Patches 52 Flaws, Including 22-Year-Old Bug Enabling Authenticated RCE Cyber Risks · Nov 13, 2026