Cyber Risks · PortSwigger Research

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