Cyber Risks · PortSwigger Research

Lab: Reflected XSS with AngularJS sandbox escape without strings

Summary: This PortSwigger lab presents an AngularJS sandbox escape in which the $eval function is unavailable and no strings can be used, requiring a cross-site scripting attack that executes alert without $eval. The exploit uses toString() to create a string without quotes, gets the String prototype, overwrites the charAt function for every string to break the sandbox, then passes an array to the orderBy filter and uses fromCharCode to build the payload x=alert(1).

Why it matters: The bypass works by overwriting charAt on the String prototype, so a single altered built-in function lets AngularJS accept code it would normally block - a reminder that client-side sandboxes are only as strong as the primitives they leave reachable.

Read the original at PortSwigger Research ↗

Topics
Vulnerabilities & Patching
Related