Clickjacking

Last reviewed:

Clickjacking is a malicious technique used by attackers to deceive users into clicking on something different from what they perceive, potentially to unauthorized actions or information disclosure. The term "clickjacking" is a combination of "click" and "hijacking," indicating the attacker's intent to hijack a user's click to perform unintended actions. As of October 2023, clickjacking remains a prevalent threat due to its simplicity and effectiveness. Attackers often exploit this technique to manipulate users into clicking on hidden elements, such as buttons or links, that are overlaid or disguised by other content.

Overview

Clickjacking is a type of web-based attack where a user is tricked into clicking on a concealed or disguised element within a webpage. This technique can lead to various malicious outcomes, including unauthorized transactions, information leakage, or the execution of unintended actions. The attack relies on the user's trust in the visible content while the actual target of the click is hidden or obscured. Clickjacking can affect any website that allows user interaction, making it a widespread concern for web developers and security professionals.

How it works

Clickjacking exploits the way web browsers render content. Attackers typically use HTML and CSS to overlay a transparent or opaque layer over a legitimate webpage. This layer contains hidden elements, such as buttons or links, that the attacker wants the user to interact with. When the user clicks on the visible content, they unknowingly interact with the hidden element, executing the attacker's desired action.

A common method involves using an iframe, an HTML element that allows embedding another HTML page within the current page. The attacker positions the iframe over a legitimate button or link, making it appear as though the user is interacting with the intended element. However, the click is actually registered on the hidden iframe, to unintended consequences.

Observed use

Clickjacking has been observed in various malicious campaigns, often targeting social media platforms, online banking sites, and e-commerce websites. Attackers use clickjacking to increase the number of likes or shares on social media, initiate unauthorized financial transactions, or redirect users to phishing sites. In some cases, clickjacking has been used to enable a user's webcam or microphone without their consent, posing significant privacy risks.

Security researchers have documented instances where clickjacking was employed to manipulate voting systems, steal sensitive information, or execute malware. The technique's versatility and simplicity make it an attractive option for attackers seeking to exploit user trust and web application vulnerabilities.

Detection

Detecting clickjacking can be challenging, as the attack relies on manipulating the user's perception rather than exploiting a technical vulnerability. However, several methods can help identify potential clickjacking attempts:

  1. Visual Inspection: Manually inspecting the webpage for suspicious overlays or hidden elements can reveal clickjacking attempts. This method requires a keen eye and understanding of web design.
  1. Browser Extensions: Some browser extensions are designed to detect and block clickjacking attempts by identifying suspicious iframes or overlays.
  1. Security Testing Tools: Automated security testing tools can scan web applications for clickjacking vulnerabilities by analyzing the HTML and CSS structure for hidden elements.
  1. User Reports: Users may report unusual behavior or unexpected actions, prompting further investigation into potential clickjacking attacks.

Mitigation

Preventing clickjacking involves implementing security measures at both the server and client levels. Key mitigation strategies include:

  1. X-Frame-Options Header: This HTTP header can be set to prevent a webpage from being embedded in an iframe, effectively blocking clickjacking attempts. The header can be configured with values like "DENY" or "SAMEORIGIN" to restrict framing.
  1. Content Security Policy (CSP): CSP is a security feature that allows web developers to control resources that a webpage can load. By specifying "frame-ancestors" in the CSP, developers can restrict which domains are allowed to embed their content.
  1. User Education: Educating users about the risks of clickjacking and encouraging them to be cautious when interacting with unfamiliar websites can reduce the likelihood of falling victim to such attacks.
  1. Regular Security Audits: Conducting regular security audits and vulnerability assessments can help identify and address potential clickjacking vulnerabilities in web applications.
  1. Browser Security Features: Encouraging users to enable security features in their browsers, such as blocking third-party cookies and enabling "Do Not Track" settings, can provide additional protection against clickjacking.

Clickjacking Attack Flow

Common Outcomes of Clickjacking Attacks

See also

Sources

Categories: Techniques
Last updated: August 29, 2026