Lab: Exploiting clickjacking vulnerability to trigger DOM-based XSS
This lab contains a XSS vulnerability that is triggered by a click. Construct a clickjacking attack that fools the user into clicking the "Click me" button to execute an XSS payload that alerts document.cookie.
The victim will be using Chrome so test your exploit on that browser.
Go to the exploit server and paste the following HTML template into the "Body" section:
src="$url?name=<img src=1 onerror=alert(document.cookie)>&email@example.com&subject=test&message=test#feedbackResult"></iframe>
Make the following adjustments to the template:
$urlin the iframe
srcattribute with the URL for the target website's "Submit feedback" page.
- Substitute suitable pixel values for the $height_value and $width_value variables of the iframe (we suggest 700px and 500px respectively).
- Substitute suitable pixel values for the $top_value and $side_value variables of the decoy web content so that the "Submit feedback" button and the "Test me" decoy action align (we suggest 610px and 80px respectively).
- Set the opacity value $opacity to ensure that the target iframe is transparent. Initially, use an opacity of 0.1 so that you can align the iframe actions and adjust the position values as necessary. For the submitted attack a value of 0.0001 will work.
- Click "Store" and then "View exploit".
- Hover over "Test me" and ensure the cursor changes to a hand indicating that the div element is positioned correctly. If not, adjust the position of the div element by modifying the top and left properties of the style sheet.
- Click "Test me" and you should see an alert.
- Change "Test me" to "Click me" and click "Store" on the exploit server.
- Now click on "deliver exploit to victim" and the lab should be solved.