Open In App

What is Clickjacking?

Last Updated : 08 May, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Clickjacking also known as UI redressing is one of the common cyber security attacks. In this attack, the end user is given a webpage which looks legitimate and he/she is tricked into clicking on malicious links. But behind the scenes, a specifically crafted page is loaded behind the legitimate looking page. To the end user it feels like, the component in the UI is being clicked, but unfortunately the click is made on the invisible component in the hidden page and the action mapped for that button click will be performed.

How Clickjacking Works?

Clickjacking involves layering a transparent frame (iframe) over a web page that seems harmless to the users. Below is a step-by-step breakdown of how clickjacking operates:

1. Create Fake Page: The attacker creates a page (iphone.php) that tempts the user to click a “Free iPhone” button.

2. Load Hidden Target Page: Behind the fake page, the attacker loads a sensitive page (e.g., bank’s transfer.php) using an iframe, making it invisible with CSS.

3. Use iFrame: The iframe tag embeds the target page inside the fake page (iphone.php).

4. User Clicks Button: The user clicks the “Free iPhone” button, but it’s mapped to the hidden transfer.php page.

5. Perform Malicious Action: The hidden page performs malicious actions like transferring funds from the user’s account.

6. Outcome: The user unknowingly triggers actions on a different page, leading to unauthorized actions like financial transfers.

Why Clickjacking Works?

  • It manipulates the user’s click to interact with a hidden page.
  • Simple to execute with basic HTML knowledge.
  • Many organizations don’t consider it a serious vulnerability, despite its risk.

Types of Clickjacking

Clickjacking takes advantage of web technologies to trick users into clicking on something harmful without knowing it. As web tools evolve, so do way attackers make benefit of them. Here are the most common types of clickjacking attacks:

Transparent Overlay

The hidden malicious page in placed beneath the real page, which won’t let the user know what link they’re actually clicking upon. The real page here is loaded into the iframe.

Cropping

Cropping is more complicated than transparent overlay where, only a few parts of the malicious page are placed over the real page. These parts could be buttons, links or images.

For example, they could:

  • Replace normal links with redirects to harmful sites.
  • Change button text to confuse the user.
  • Alter content in ways that mislead the victim.

Hidden Overlay

A tiny hidden box (like 1×1 pixel) is placed under your mouse. When you click, you’re clicking something you can’t see and any clock by the user will now redirect them to the malicious page.

Click Event Dropping

In this type of clickjacking the attackers the value of CSS pointer-events to none due to which they seem to be non-functional, but beneath the website they’re actually clicking in the malicious page.

Rapid Content Switch

This method is used by attackers who understand user behavior and interface design. They briefly remove an overlay so a hidden button can be clicked, and then replace it almost instantly. The change is so quick that users may not realize they clicked on something malicious.

Scrolling

In this method, the attacker creates what looks like a pop-up or dialog box with a button that’s not completely visible on the screen. The button actually leads to a malicious page. This trick may fail if the user has an ad blocker or pop-up blocker enabled.

Protection from Clickjacking

Clickjacking is a serious threat, but it can be prevented using technical and behavioral measures. Website developers and end-users both play a role in preventing such attacks. Below are strategies, including HTTP headers and safe browsing practices, to protect against clickjacking attempts.

1. Prevent Framing of Content:

  • Ensure that content on your website is not loaded inside an iframe. This can be done by setting the X-Frame-Options response header to control how the page is framed.

2. Use the X-Frame-Options Header:

  • The X-Frame-Options header can have three possible values:
  • DENY: Prevents the page from being loaded inside any frame, even if it’s hosted on your own website.

Example: X-Frame-Options: DENY

  • SAMEORIGIN: Allows the page to be loaded in a frame, but only if the page is hosted on the same domain.

Example: X-Frame-Options: SAMEORIGIN

  • ALLOW-FROM URI: Allows the page to be loaded inside a frame from a specific, trusted domain.

Example: X-Frame-Options: ALLOW-FROM https://trustedsite.com

3. Workarounds for Multiple Domains:

  • Although the ALLOW-FROM header doesn’t support multiple domains natively, you can implement workarounds by creating unique endpoints or URLs for each trusted domain, and configuring the X-Frame-Options header for each one.

4. End-User Precaution:

  • As an end-user, be cautious when clicking on components in ads or spam pages, and avoid opening emails from untrusted sources to reduce the risk of falling victim to a clickjacking attack.

Conclusion

Clickjacking is a deceptive and dangerous cyber attack where an attacker manipulates the user’s actions by hiding malicious pages behind seemingly legitimate ones. In this attack, a user believes they are clicking on a harmless component, but in reality, they are unknowingly performing actions on a hidden page, such as transferring funds or divulging sensitive information. Despite its simplicity and potential risk, many organizations overlook clickjacking vulnerabilities, leaving their systems exposed.

However, preventing clickjacking is possible by implementing proper protective measures. Ensuring that content is not loaded in iframes and setting the X-Frame-Options header with appropriate values can help protect against these attacks. Additionally, users should be cautious when interacting with unfamiliar ads or spam pages, especially when receiving unsolicited emails.



Next Article

Similar Reads