Lab: Reflected XSS into HTML context with all tags blocked except custom ones
Summary: PortSwigger's lab blocks all HTML tags except custom ones, and the solution is a reflected cross-site scripting attack that injects a custom tag with an ID of x carrying an onfocus event handler that calls the alert function. A hash appended to the URL focuses the element as soon as the page loads, which triggers the payload and alerts document.cookie.
Why it matters: The bypass does not need a standard tag at all: a custom element plus an onfocus handler and a URL fragment is enough to read document.cookie, so an allowlist that only permits custom tags still leaves the door open.
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