Cyber Risks · PortSwigger Research

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