Testing for HTML injection
HTML injection is when a user has access to an input parameter on the web application and can inject arbitrary HTML code into that web page.
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, you will utilize the search blog feature, which has a vulnerability to DOM-based XSS. The attack will make use of an innerHTML assignment that modifies a div element’s HTML contents using information from location.search. The result will be performing a cross-site scripting attack that calls the alert function to finish the lab.
Perform the following steps to get started:
- Navigate to the URL with the browser proxied to ZAP and log into the PortSwigger Academy website to launch the lab (https://portswigger.net/web-security/cross-site-scripting/dom-based/lab-innerhtml-sink).
- Within the lab application, type the following...