Clickjacking, often referred to as a UI redress attack, is a cyberattack that exploits users’ trust by overlaying invisible or disguised elements on a webpage. Attackers trick victims into performing unintended actions.
This horrific attack can have horrific consequences, including financial, reputational, and legal complications.
In this article, we’ll explore what is clickjacking, understand its various types, and discuss actionable strategies to prevent such attacks. This guide will provide comprehensive insights into one of the most deceptive tactics in cybersecurity.
Without further ado, let’s jump right in!
What is Clickjacking?
Clickjacking refers to an attack that manipulates a user’s click, making the user perform clicks that they did not intend to. For example, making the user click on another element disguised as another element that the user actually wanted to click on.
These unwanted and unintended clicks can lead to malware or ransomware installation, malicious websites, money transfers to cybercriminals’ bank accounts, placing an order, clicking on an advertisement or malvertisement, etc.
Clickjacking is a deadly cybercrime that can cause several security problems, including identity theft and critical financial loss.
An Example of Clickjacking Attack
Clickjacking is typically performed by wrapping a legitimate-looking element with an invisible element inside the iframe, which causes the customer or visitor to see a clean webpage that looks exactly the same as the way web pages appear. This legitimacy tricks the users into believing that they are surfing a legit website, alluring them into clicking on elements that the cybercriminal wants them to.
For instance, let’s assume a visitor lands at a store and sees a product they want. They click on the product, but on the product, there is an invisible element that will send the money directly to the cyberattacker’s account.
Once the user sees the checkout screen—cash transfer in disguise—they will fill up the information with their credit/debit card and hit the ‘Buy Now’ button, which, in fact, is just the ‘Transfer Amount’ button, and clicking on it will just send the amount to the hacker’s account.
Types of Clickjacking Attack
There are several types of clickjacking, including:
- Likejacking: This refers to when an invisible screen is placed over a Facebook’s like button, causing the victim to like other pages or posts that the user did not intend to.
- Cursorjacking: This refers to the technique of manipulating the user’s cursor, making it appear away from where it actually is. Hence, the victim may perform actions that would leak their sensitive information or download malicious code or script onto the victim’s computer.
- Cookiejacking: This refers to when an attacker exploits vulnerabilities in a web browser or tricks a user into performing actions that inadvertently grant the attacker access to cookies.
- Formjacking: This refers to when an attacker overlays an invisible form or input field on top of legitimate content to trick users into entering sensitive information, such as login credentials or credit card details.
- Filejacking: It is when a victim is tricked into dragging and dropping files into a malicious frame or area. These attacks are intended to gain unauthorized access to files on the victim’s device.
- Clipboard Hijacking: This attack occurs to steal cryptocurrencies. Attackers use scripts to replace or manipulate the clipboard content and replace copied wallet addresses for cryptocurrency transactions.
- Scroll jacking: A technique where an attacker manipulates the way a web page scrolls by altering the scroll behavior. This practice confuses the victim, causing it to interact with elements they didn’t intend.
- Adjacking: It occurs when attackers overlay ads or buttons over legitimate content to generate fake clicks to generate heaps of ad revenue.
Check if Your Website is Vulnerable to Clickjacking
Before we move to the precautionary measure, you must first ensure whether your website is actually vulnerable to such attacks. To do so, there are four easy ways:
#1: Use Browser Developer Tools
- Open your website in a browser.
- Use browser developer tools (press `F12` or right-click > Inspect).
- Go to the Network tab and check the HTTP headers for responses from your server.
- Look for the `X-Frame-Options` or `Content-Security-Policy` headers.
If these headers are absent or misconfigured, your site might be vulnerable.
#2: Use Online Testing Tools
Tools like Sucuri SiteCheck or Observatory by Mozilla can help point at such problems by analyzing your website’s security headers, which can protect against clickjacking.
#3: Leverage Security Testing Software
If you don’t want to use online tools, you can go for software like OWASP ZAP or SQL Map. Such a software can easily help you identify clickjacking vulnerabilities by performing penetration tests.
#4: Manual Testing
If you don’t want to rely on any software or online tool, you can check for the site vulnerability manually as well. Here’s how you can create an HTML page to evaluate your site’s vulnerability to clickjacking attacks.
Create a Test HTML Page, embed your website in an <iframe>, and observe its behavior.
You can use the following code:
“`html
<!DOCTYPE html>
<html>
<head>
<title>Clickjacking Test</title>
</head>
<body>
<h1>Clickjacking Test</h1>
<iframe src=”https://yourwebsite.com” width=”800″ height=”600″></iframe>
</body>
</html>
“`
Save this code as a .html file and open it in a browser.
If your website loads in the iframe, it is vulnerable to clickjacking. Conversely, if it doesn’t load and displays an error, it is likely protected by X-Frame-Options or Content-Security-Policy.
Here are some useful tips while testing for the vulnerability of clickjacking.
- Test All Critical Pages. All the pages can be vulnerable to such attacks, not just the homepage. Clickjacking can target login forms, payment pages, or other sensitive content. Thus, testing all the pages across a website is imperative.
- Ensure Consistency. Make sure that both HTTP and HTTPS versions of your site are protected.
What to do if Your Site is Vulnerable
You just run the tests and discover your site is vulnerable to clickjacking. Here’s what to do next.
- Add the X-Frame-Options or Content-Security-Policy headers to your server configuration. These tools restrict a web page from embedding within an iframe. Hence protecting clickjacking.
- Regularly audit your site’s security and test new features for vulnerabilities.
- Implement additional security measures like CSRF protection and CAPTCHA for sensitive actions.
12 Ways To Prevent Clickjacking
Here’s what you can do to prevent clickjacking from occurring in the near future:
- Use X-Frame-Options Header: Add the X-Frame-Options HTTP response header to restrict how your site can be framed. Prevent your site from being embedded in an iframe.
- Implement Content Security Policy (CSP): Use the frame-ancestors directive to control which domains can embed your site in iframes.
- Avoid Embedding Sensitive Content in iFrames: Minimize the use of iframes, especially for sensitive data or critical functionalities, unless necessary.
- Frame Busting Scripts: Include JavaScript to bust out of iframes, forcing the page to load in the top-level window.
- User Authentication Tokens: Pair sensitive actions with CSRF tokens or reCAPTCHA challenges to ensure the user intentionally initiates them. You can use Password Protected to implement reCAPTCHA.
- Regularly Test Your Website: Conduct penetration testing to identify potential vulnerabilities to clickjacking.
- Enable Browser Security Features: Use browsers that block malicious iframes by default or support extensions that enable you to do so.
- Always Double Check Before Clicking Links: Avoid clicking on suspicious or unknown links that may redirect to clickjacked pages.
- Use a Reputable Ad Blocker: We discussed adjacking, which refers to adding an invisible element over an advertisement. Ad blockers help reduce exposure to such threats.
- Update Your Software: Ensure browsers, plugins, and operating systems are updated to avoid exploitation of known vulnerabilities.
- Educate Users: If you run an organization or a business, train employees and customers to recognize and avoid suspicious links or websites and enlighten them about cybersecurity and WordPress security best practices.
- Monitor Third-Party Integrations: Keep a sharp eye on any plugin, extension, or piece of code that adds additional functionality to your website. These codes may contain vulnerabilities that hackers can exploit.
Conclusion
Clickjacking can be deadly. It is an attack that manipulates a user’s click, making them perform actions they did not intend to. There are multiple kinds of clickjacking, and each can impact the victim differently. Some of them steal sensitive information, and others are created to steal your hard-earned cash or cryptocurrencies.
Moreover, checking for the vulnerability of your website for clickjacking attacks is essential. You can do that using browser developer tools, online tools, or dedicated security software. If you don’t want to use an additional tool, you can perform the check manually by creating an HTML file and embedding your website in an <iframe>.
Finally, if your website is actually vulnerable to such attacks, add X-Frame-Options or Content-Security-Policy headers to your server configuration. These tools restrict a web page from being embedded within an iframe, which can protect your website from such happenings.
To make your website private while you perform the safety measures, try Password Protected.
Frequently Asked Questions
What is clickjacking with an example?
Clickjacking is the practice of manipulating a victim’s click to make them perform actions they did not intend to, such as clicking on an element, filling out a form with sensitive information, etc. For instance, a victim receives an email with a link to a malicious website that looks legitimate and offers a crazy, too-good-to-be-true offer. Once the victim lands on the website, they will receive a pop-up asking them to fill out the form with their credit card information and click a specific button to claim the offer. However, as soon as the victim clicks on it, the sensitive information is sent to the attacker.
What is clickjacking, in simple words?
When an attacker makes the victim click on another element that the victim did not intend to click on, it is known as clickjacking. The cursor will appear in another place instead of where it actually is, causing the victim to click on unintended elements.
What is the difference between clickjacking and phishing?
Phishing and clickjacking both trick users into leaking sensitive information. The phishing includes deceiving the victim using malicious emails or tricking them into sharing their login credentials or credit card information. Conversely, clickjacking manipulates the user interface and makes them click on elements that they did not intend to.

