Cyber Risks · PortSwigger Research

Lab: DOM XSS in jQuery anchor href attribute sink using location.search source

Summary: PortSwigger's Web Security Academy lab describes a DOM-based cross-site scripting vulnerability on a submit feedback page, where the jQuery $ selector function finds an anchor element and changes its href attribute using data from location.search. The solution is to set the returnPath query parameter to javascript:alert(document.cookie), which places that value inside the a href attribute and executes when the back link is clicked.

What you should know: The sink is a single anchor href fed directly from location.search, so a crafted returnPath value turns an ordinary back link into script execution that can read document.cookie.

Read the original at PortSwigger Research ↗

Topics
Vulnerabilities & Patching
Related