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
- 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