Lab: DOM XSS using web messages and a Java Script URL
Summary: PortSwigger's lab demonstrates a DOM-based redirection vulnerability triggered by web messaging, where a page's event listener checks for the string "http:" and then passes the message payload to the location.href sink. The exploit page adds an iframe that calls postMessage() with an arbitrary JavaScript payload and an any-targetOrigin argument, causing the print() function to run when the iframe loads.
What's compelling: The flaw turns a permissive postMessage listener into script execution through location.href, so any page that accepts messages from any origin and routes them to a navigation sink hands an attacker the same primitive this lab uses to call print().
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