Cyber Risks · PortSwigger Research

Lab: DOM XSS in document.write sink using source location.search inside a select element

Summary: This PortSwigger lab contains a DOM-based cross-site scripting vulnerability in the stock checker functionality, where the JavaScript document.write function is called with data from location.search that the user can control through the website URL. The data is enclosed within a select element, and solving the lab requires an XSS attack that breaks out of the select element and calls the alert function via the storeId parameter.

Bottom line: The flaw is a client-side sink that writes URL-controlled input straight into the page, so a crafted storeId parameter in a link is enough to execute script in a victim's browser - a reminder that DOM sinks like document.write bypass server-side filtering entirely.

Read the original at PortSwigger Research ↗

Topics
Vulnerabilities & Patching
Related