Skip to content

LAB 10 - DOM XSS in document.write sink using source location.search inside a select element

Initial instructions

This lab contains a DOM-based cross-site scripting vulnerability in the stock checker functionality. It uses the JavaScript document.write function, which writes data out to the page. The document.write function is called with data from location.search which you can control using the website URL. The data is enclosed within a select element.

To solve this lab, perform a cross-site scripting attack that breaks out of the select element and calls the alert function.

To complete this lab I used the following XSS payload.

"><script>alert(1)</script>

Then I entered to any product and I intercepted the request when I clicked in Check stock.

alt text

Here I have the following request via POST but sending this parameters and data.

alt text

Then I tried this last parameter but via GET looking like that.

And we successfully injected our malicious payload.

alt text

Congratulations, you solved the lab!