December 4, 2026
Clickjacking Vulnerability: How Attackers Trick Users Into Clicking What They Cannot See
A Practical Guide to Understanding, Testing, Exploiting and Fixing Clickjacking in Web Applications

By Yamini Yadav_369
9 min read
Imagine visiting a website and clicking a button that says "Watch Video." You think you are simply playing a video, but something else happens in the background. Your click is actually submitted to another website, where you are unknowingly changing an account setting, enabling a feature, or performing an action.
You did not see the real button.
You did not intend to perform that action.
But your browser did exactly what the attacker wanted.
This is the basic idea behind Clickjacking.
Clickjacking is one of those web application vulnerabilities that can look harmless during an initial security assessment. The website loads normally, authentication works correctly, and there may be no suspicious request or visible error.
The problem is not always what the application displays. It is what an attacker can make a legitimate user click without their knowledge.
In this article, we will understand how clickjacking works, how to test it practically, what makes it dangerous, how to identify false positives, and how developers can prevent it.
Table of Contents
- What Is Clickjacking?
- How Does Clickjacking Work?
- Understanding the Technical Mechanism
- Practical Clickjacking Testing
- Testing with Burp Suite and Browser Developer Tools
- How to Identify a Real Security Impact
- Common Misconceptions and False Positives
- How to Prevent Clickjacking
- Security Testing Checklist
- How to Write a Professional VAPT Finding
- Final Thoughts
1. What Is Clickjacking?
Clickjacking, also known as UI Redressing, is a web security vulnerability in which an attacker tricks a user into interacting with a website element that is hidden, disguised, or positioned behind another visible element.
The attacker typically loads a legitimate target website inside an HTML iframe and places another interface on top of it.
The victim believes they are clicking one element, but the actual click is delivered to an element belonging to the target application.
For example:
- A user thinks they are clicking a play button.
- An attacker positions a sensitive account button underneath it.
- The user clicks the visible play button.
- The browser sends the click to the underlying application.
The important point is that the user is interacting with a genuine application interface, but they are being manipulated into performing an unintended action.
Clickjacking does not necessarily require stealing passwords, bypassing authentication, or injecting malicious JavaScript into the target website.
It abuses how browsers handle frames and user interactions.
2. How Does Clickjacking Work?
Let's understand the attack through a simple scenario.
Suppose an application has a settings page with a button:
Enable Public Profile
An attacker wants an authenticated user to enable this feature without understanding what they are doing.
The attacker creates a webpage containing:
- A fake button that says "Click to Win a Prize."
- An iframe loading the legitimate application.
- CSS positioning that places the real application button underneath the fake button.
- A carefully positioned interface that encourages the victim to click.
When the victim clicks the fake button, the browser may deliver that click to the actual button inside the iframe.
The target application processes the action using the victim's existing authenticated session, subject to its normal security controls.
Understanding the attack flow
Attacker creates a deceptive webpage
|
v
Target application loaded in iframe
|
v
Fake interface placed over target interface
|
v
Victim visits attacker's webpage
|
v
Victim clicks an apparently harmless button
|
v
Click reaches the underlying application
|
v
Unintended action may be performedAttacker creates a deceptive webpage
|
v
Target application loaded in iframe
|
v
Fake interface placed over target interface
|
v
Victim visits attacker's webpage
|
v
Victim clicks an apparently harmless button
|
v
Click reaches the underlying application
|
v
Unintended action may be performedThis attack is possible because browsers support embedding webpages inside iframes unless the target application restricts that behavior.
However, iframe loading alone does not establish a successful clickjacking vulnerability. The attacker must also be able to manipulate a meaningful user interaction.
3. Understanding the Technical Mechanism
Before testing, understand three important browser concepts.
A. HTML iframe
An iframe allows one webpage to display another webpage inside its document.
Example:
<iframe
src="https://target.example.com/account/settings"
width="800"
height="600">
</iframe><iframe
src="https://target.example.com/account/settings"
width="800"
height="600">
</iframe>If the target website allows framing, the browser may display it inside the attacker's webpage.
If the target uses appropriate framing restrictions, the browser should block the embedding.
B. CSS positioning and opacity
An attacker can use CSS to position an iframe and another interface on top of it.
For example:
iframe {
position: absolute;
top: 100px;
left: 100px;
width: 800px;
height: 600px;
opacity: 0.01;
}iframe {
position: absolute;
top: 100px;
left: 100px;
width: 800px;
height: 600px;
opacity: 0.01;
}The iframe is nearly transparent but remains present.
A visible interface can be positioned above it to deceive the user.
This is an illustrative technique. Actual clickjacking layouts depend on the target interface and browser behavior.
C. Browser security headers
Two important HTTP response headers help prevent clickjacking.
X-Frame-Options
This header controls whether a page can be displayed in a frame.
Common values:
X-Frame-Options: DENYX-Frame-Options: DENYPrevents the page from being framed.
X-Frame-Options: SAMEORIGINX-Frame-Options: SAMEORIGINAllows framing only by pages from the same origin.
Content-Security-Policy: frame-ancestors
This is the modern and more flexible framing restriction.
Example:
Content-Security-Policy: frame-ancestors 'none';Content-Security-Policy: frame-ancestors 'none';This prevents the page from being embedded by any origin.
Another example:
Content-Security-Policy: frame-ancestors 'self';Content-Security-Policy: frame-ancestors 'self';This allows framing only by the same origin.
For a specific trusted parent application:
Content-Security-Policy: frame-ancestors 'self' https://trusted.example.com;Content-Security-Policy: frame-ancestors 'self' https://trusted.example.com;The important difference is that frame-ancestors controls which websites are allowed to embed the protected page.
Unlike many other CSP directives, frame-ancestors must be delivered through an HTTP response header, not a meta tag.
4. Practical Clickjacking Testing
Now let's move from theory to practical security testing.
Assume you are conducting an authorized web application penetration test.
Your objective is to determine whether an authenticated or unauthenticated page can be embedded by an external website and whether a meaningful user interaction can be manipulated.
Step 1: Identify interesting application pages
Start by reviewing application functionality.
Pay particular attention to:
- Account settings
- Profile management
- Email and password settings
- Administrative dashboards
- Payment or transaction confirmation pages
- User permission management
- Security configuration pages
Not every page has the same security impact.
A publicly accessible informational page may be frameable without presenting a meaningful security issue.
Step 2: Inspect HTTP response headers
Use curl to inspect the response:
curl -I https://target.example.comcurl -I https://target.example.comLook for:
X-Frame-Options: DENYX-Frame-Options: DENYOr:
X-Frame-Options: SAMEORIGINX-Frame-Options: SAMEORIGINAlso inspect:
Content-Security-Policy: frame-ancestors 'none'Content-Security-Policy: frame-ancestors 'none'You can filter relevant headers:
curl -sI https://target.example.com | grep -Ei \
'content-security-policy|x-frame-options'curl -sI https://target.example.com | grep -Ei \
'content-security-policy|x-frame-options'If neither header is present, investigate further.
Remember: missing headers are an indication to test, not automatic proof of exploitable clickjacking.
Step 3: Create a basic PoC page
Create a local HTML file named:
clickjacking-test.html
Use this code for an authorized, non-destructive framing test:
<!DOCTYPE html>
<html>
<head>
<title>Clickjacking Security Test</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
}
iframe {
width: 900px;
height: 600px;
border: 3px solid red;
}
</style>
</head>
<body>
<h2>Clickjacking Framing Test</h2>
<p>
Testing whether the target application
permits external framing.
</p>
<iframe
src="https://target.example.com">
</iframe>
</body>
</html><!DOCTYPE html>
<html>
<head>
<title>Clickjacking Security Test</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
}
iframe {
width: 900px;
height: 600px;
border: 3px solid red;
}
</style>
</head>
<body>
<h2>Clickjacking Framing Test</h2>
<p>
Testing whether the target application
permits external framing.
</p>
<iframe
src="https://target.example.com">
</iframe>
</body>
</html>Replace the example domain with your authorized test target.
Open the HTML file in a browser.
Step 4: Observe the result
There are two possible outcomes.
Scenario A: The website loads inside the iframe
This suggests that the target may permit framing.
Continue testing to understand whether an attacker-controlled external origin can embed sensitive pages.
Scenario B: The browser blocks the iframe
The website may have implemented effective framing restrictions.
Inspect the browser console for messages relating to:
- X-Frame-Options
- CSP frame-ancestors
- Refused to display
- Frame loading restrictions
Save the response headers and browser evidence.
Step 5: Validate the actual security impact
This is the most important part of the assessment.
A website being frameable does not automatically mean that an attacker can successfully perform a sensitive action.
For a meaningful security finding, evaluate:
- Can an attacker-controlled external origin embed the page?
- Does the target page contain a meaningful interactive element?
- Can the element be positioned and aligned with the attacker's deceptive interface?
- Does the browser permit the intended interaction?
- Does the application accept the resulting action?
- Are there additional protections, such as confirmation steps or transaction-specific controls?
Only claim a successful clickjacking impact when you have supporting evidence.
Use a harmless test action or a controlled test account. Do not perform real financial transactions, change another user's security settings, or execute destructive operations.
5. Testing with Burp Suite and Browser Developer Tools
Burp Suite can help you inspect the HTTP responses returned by the target application.
What to do in Burp Suite
- Open Burp Suite.
- Configure your browser to use the Burp proxy.
- Visit the target application.
- Navigate to the pages selected for testing.
- Capture the HTTP response.
- Inspect the response headers.
- Record the presence or absence of framing protections.
Example response:
HTTP/2 200 OK
Content-Type: text/html; charset=UTF-8
Server: nginxHTTP/2 200 OK
Content-Type: text/html; charset=UTF-8
Server: nginxIn this example, neither X-Frame-Options nor CSP frame-ancestors is visible.
That is an observation, not yet a confirmed vulnerability.
What to inspect in browser developer tools
Open Developer Tools and check:
Network tab
- Select the relevant document request.
- Inspect response headers.
- Confirm which headers were actually delivered.
Console tab
- Check whether the browser blocks framing.
- Record any CSP or X-Frame-Options errors.
Elements tab
- Inspect whether the target page is rendered inside the iframe.
- Observe the page layout and interactive elements.
This combination provides better evidence than relying on an automated header scan alone.
6. How to Identify a Real Security Impact
Let's compare three testing outcomes.
ObservationAssessmentFraming protection headers are missingPotential security misconfigurationExternal iframe successfully displays the target pageFraming is permittedSensitive interaction can be manipulated and executedConfirmed clickjacking impact, subject to evidence
Consider two examples.
Example 1: Public information page
An attacker can embed a public company information page.
There is no sensitive interaction or meaningful user impact.
This is generally a low-impact observation and may not justify a standalone vulnerability finding.
Example 2: Authenticated account settings
An attacker can embed a sensitive account settings page. A deceptive interface can align with a security-related button, and a controlled test demonstrates that an authenticated user can unknowingly activate it.
This represents a much stronger security finding.
The impact depends on the functionality exposed and the action that can actually be performed.
7. Common Misconceptions and False Positives
During penetration testing, several mistakes can lead to incorrect clickjacking reports.
Mistake 1: Missing X-Frame-Options means confirmed clickjacking
Incorrect.
A valid CSP frame-ancestors policy can provide the required protection even if X-Frame-Options is absent.
Mistake 2: Every iframe vulnerability is clickjacking
Incorrect.
An application may permit framing for legitimate business purposes without exposing any exploitable user interaction.
Mistake 3: A visible page inside an iframe proves sensitive impact
Incorrect.
You must establish that an attacker can manipulate a meaningful action.
Mistake 4: X-Frame-Options is the only required defense
Incorrect.
Modern applications should use CSP frame-ancestors as their primary framing policy and consider X-Frame-Options for compatibility with older browsers.
8. How to Prevent Clickjacking
Developers should implement framing restrictions based on application requirements.
Recommended configuration
For applications that should never be framed:
Content-Security-Policy: frame-ancestors 'none';
X-Frame-Options: DENYContent-Security-Policy: frame-ancestors 'none';
X-Frame-Options: DENYFor applications that should only be framed by their own origin:
Content-Security-Policy: frame-ancestors 'self';
X-Frame-Options: SAMEORIGINContent-Security-Policy: frame-ancestors 'self';
X-Frame-Options: SAMEORIGINFor applications that require trusted external framing, explicitly define the permitted origins in frame-ancestors.
Do not use a wildcard or unnecessarily broad allowlist.
Additional security recommendations
- Apply framing policies consistently to sensitive pages.
- Avoid relying exclusively on JavaScript frame-busting techniques.
- Review third-party integrations that require iframe embedding.
- Protect sensitive actions with appropriate confirmation and authorization controls.
- Review session and cookie configurations, including SameSite settings.
- Re-test framing restrictions after deployment.
SameSite cookie settings can provide additional protection in some cross-site scenarios, but they are not a replacement for frame-ancestors.
9. Security Testing Checklist
Use this checklist during an authorized web application security assessment.
- Identify sensitive application pages.
- Inspect X-Frame-Options.
- Inspect CSP frame-ancestors.
- Check for inconsistent policies across endpoints.
- Test embedding from an external origin.
- Review browser console errors.
- Validate authenticated and unauthenticated behavior.
- Identify meaningful interactive elements.
- Verify actual impact using a controlled test account.
- Capture screenshots and HTTP evidence.
- Recommend appropriate framing restrictions.
- Retest after remediation.
10. How to Write a Professional VAPT Finding
If testing confirms an exploitable clickjacking issue, a report could contain the following information.
Finding Title: Clickjacking Vulnerability Due to Missing Frame Protection
Description:
The application does not implement adequate anti-framing protections on the affected page. As a result, an attacker-controlled website may be able to embed the application within an iframe and manipulate the visual presentation to deceive authenticated users into interacting with unintended application elements.
Potential Impact:
Depending on the affected functionality, successful exploitation could result in unintended account changes, unauthorized user interactions, or other sensitive actions being performed through the victim's authenticated session.
Evidence:
- Relevant HTTP response headers.
- External framing test.
- Browser console observations.
- Controlled proof of the unintended interaction, where safely demonstrated.
Recommendation:
Implement an appropriate Content-Security-Policy frame-ancestors directive. Use X-Frame-Options as an additional compatibility measure where required. Ensure that framing restrictions are applied consistently to sensitive application pages.
Important: Assign severity according to the demonstrated impact, affected functionality, and exploitability. Do not classify every missing framing header as a High or Medium vulnerability automatically.
11. Final Thoughts
Clickjacking is a good example of why web application security testing should go beyond checking HTTP headers.
A missing security header may indicate a weakness, but a good penetration tester needs to understand the complete attack scenario.
Can the page be embedded?
Can the attacker manipulate the user's interaction?
Can a meaningful action actually be performed?
These are the questions that separate a simple configuration observation from a properly validated security finding.
When conducting a VAPT assessment, focus on evidence, application functionality, and real-world impact rather than reporting every missing header as an exploitable vulnerability.
The goal is not just to discover security weaknesses. It is to understand how they can affect real users and help developers fix them effectively.
Let's Connect and Learn Together!
If you found this article useful:
š Give this article some claps to support more practical cybersecurity content.
ā Follow me for more hands-on tutorials, penetration testing techniques, vulnerability research, and real-world security testing experiences.
š¬ Let's discuss: Have you ever discovered a clickjacking vulnerability during a VAPT assessment? What was the actual impact, and how did you validate it?
š Share this article with someone who is learning web application security.
Keep learning. Keep testing. Keep securing.
Cybersecurity Ā· Web Security Ā· Penetration Testing Ā· Ethical Hacking Ā· Bug Bounty