Testing for DOM-based cross-site scripting
This is opposed to reflected cross-site scripting, where malicious JavaScript is returned by the web server, or stored XSS, where attacks are permanently stored on the target server or database. Both of those attacks are server-side injection issues. When it comes to DOM XSS, it is purely client side. DOM XSS is an attack against the client (browser) DOM environment.
Getting ready
This lab requires a PortSwigger Academy account and ZAP to intercept requests and responses from the server to your browser.
How to do it...
In this recipe, users will attack the search query tracking feature, which has a DOM-based XSS vulnerability. This weakness makes use of the document.write
JavaScript function to output data to the web page. Then data from location.search
, which can be modified using the URL, passes to the document.write
method. To complete the lab, a DOM XSS attack needs to call an alert
function.
Important note
Examining...