Cyber Risks · PortSwigger Research

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