Having trouble learning a vulnerability type? Just have ChatGPT make you a lab!
DOM XSS is a popular vulnerability type to hunt for because they’re everywhere, hard to scan for, and typically have high rewards.
Prompt:
Create a fully working lab html for DOM XSS to test against locally in a browser
Now that you have the HTML code, copy the code and paste it into your favorite text editor. Save the file as a .html
file and open it in a browser.
Just like a real target in the wild, interact with the page as a normal user first. In this case, anything entered in the search box is reflected on the page and becomes a GET request parameter in the URL:
Open the developer tools panel of your browser by right-clicking on the page and selecting “Inspect” if using Chrome. You can manipulate the q
parameter value directly in the URL bar of the browser. Try different probes or XSS payloads to test how they reflect.
For this lab, any basic XSS payload such as <script>alert()</script>
will work, but also try other ones to see them in action in this context.