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
- 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