Lab: DOM XSS in innerHTML sink using source location.search
Summary: PortSwigger's lab demonstrates a DOM-based cross-site scripting flaw in search blog functionality, where an innerHTML assignment writes data from location.search into a div element. The solution injects a payload into the search box whose invalid src attribute throws an error, triggering the onerror handler to call alert().
Why it matters: The sink is innerHTML fed directly by location.search, so a crafted search URL executes script in the victim's browser - the same pattern that turns a reflected link into an attack against any user who clicks it.
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