Cyber Risks · PortSwigger Research

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