Course contentsShow
← Security
Lesson 1133 of 3,05223. Web Security - Modern Web AttacksFree lesson

Clickjacking Fundamentals and Attack Mechanics

Understanding how attackers use invisible iframes to trick users into clicking hidden elements on a targeted page.

Clickjacking Fundamentals and Attack Mechanics

What You'll Learn

You'll learn how attackers use invisible iframes to trick users into clicking hidden elements on a targeted page, causing them to perform unintended actions.

What Is Clickjacking?

Clickjacking (also called "UI redressing") is an attack where a malicious site overlays an invisible or disguised iframe containing a legitimate website on top of its own content. When users think they're clicking on something harmless—like a "Play Video" button or "Win a Prize" link—they're actually clicking on hidden elements in the iframe, such as "Delete Account," "Authorize Payment," or "Grant Permissions."

How the Attack Works

Think of it like placing a transparent sheet over a touchscreen ATM. You see your own fake interface underneath, but every tap actually hits buttons on the real ATM screen above.

The attacker creates a page with:

  1. The malicious visible layer – Attractive content that entices clicks
  2. The invisible iframe – Positioned precisely over the visible content using CSS opacity: 0 or z-index manipulation
  3. The target site – Loaded inside the iframe, with legitimate buttons aligned perfectly under the attacker's fake buttons

When the victim clicks what appears to be an innocent element, the browser registers the click on the invisible iframe instead, triggering actions on the legitimate site where the user may already be authenticated.

Why It Works

The browser treats the iframe as the target site's legitimate origin. If the user has an active session, clicks within the iframe carry full authentication—cookies, session tokens, everything. The victim unknowingly authorizes real actions while believing they're interacting with the attacker's harmless content.

Key Takeaway: Clickjacking exploits visual deception by hiding legitimate interactive elements beneath attacker-controlled content, turning user clicks into unauthorized actions on trusted sites without the victim's awareness.