Issue #140 · important
Issue 140
What is this issue?
This issue checks whether your website has protection against clickjacking attacks by declaring either the X-Frame-Options HTTP header or the frame-ancestors directive in the Content-Security-Policy header.
What this issue checks
- The
X-Frame-Optionsheader is present with a valid value (DENYorSAMEORIGIN), OR - The
Content-Security-Policyheader includes aframe-ancestorsdirective - The header value is not misspelled or invalid (e.g.,
deniedinstead ofDENY)
What is considered a passing implementation
A passing implementation means:
- The
X-Frame-Optionsheader is present withDENYorSAMEORIGINvalue, OR - The
Content-Security-Policyheader includes aframe-ancestorsdirective - The header value is correctly spelled and cased
Real-world example
A properly configured X-Frame-Options header looks like:
X-Frame-Options: DENY
Or using the modern CSP approach:
Content-Security-Policy: frame-ancestors 'none';
These tell browsers that your page cannot be embedded in an iframe on other websites, preventing clickjacking attacks.
Why does it matter?
Clickjacking protection is important for security and SEO:
Crawlability
If your site is vulnerable to clickjacking, attackers could potentially use it to manipulate your pages or redirect users to malicious sites, which could affect your SEO if search engines detect such manipulation.
Indexability
Similar to crawlability, security vulnerabilities can lead to indexing issues if attackers manipulate your content or redirect crawlers.
Rankings
While not a direct ranking factor, sites vulnerable to clickjacking can be exploited to manipulate user behavior, potentially leading to security incidents that harm your site's reputation and search rankings.
User Experience
Clickjacking attacks trick users into performing unintended actions (like confirming payments, granting permissions, or deleting accounts) by embedding your page in a transparent iframe on a malicious site. Without protection, users can be manipulated without their knowledge.
AI Search / AEO
AI-powered search engines prioritize secure, trustworthy sites that protect users from attacks.
SEO Health Score Impact
Resolving this issue improves your overall SEO health score by protecting users from clickjacking attacks and demonstrating your commitment to security best practices.
How to fix it
Follow these steps to implement clickjacking protection:
Step 1: Choose your protection method
- Option A (Traditional): Use
X-Frame-Optionsheader (simpler, widely supported) - Option B (Modern): Use
frame-ancestorsdirective in CSP header (more flexible, recommended)
Step 2: Set X-Frame-Options header (if using Option A)
Set X-Frame-Options header on your web server, CDN, or load balancer:
X-Frame-Options: DENY
Or if you need to allow embedding from same-origin only:
X-Frame-Options: SAMEORIGIN
Step 3: Set CSP frame-ancestors directive (if using Option B)
Set CSP frame-ancestors directive:
Content-Security-Policy: frame-ancestors 'none';
Or to allow same-origin embedding:
Content-Security-Policy: frame-ancestors 'self';
Or to allow specific trusted domains:
Content-Security-Policy: frame-ancestors 'self' https://trusted-partner.com;
Step 4: Avoid deprecated ALLOW-FROM
Avoid deprecated ALLOW-FROM directive, which is not supported in modern browsers (Chrome, Firefox, Safari).
Step 5: Use correct syntax
Ensure values are uppercase and correctly spelled (DENY, not denied or Deny).
Step 6: Test your configuration
Test your configuration using browser developer tools to verify the header is present and correctly configured.
Examples
Example 1: Missing X-Frame-Options Header
Problem: The X-Frame-Options header is not present.
What fails:
HTTP response does not include X-Frame-Options header
What passes:
X-Frame-Options: DENY
Example 2: Invalid X-Frame-Options Value
Problem: The X-Frame-Options header has a misspelled or invalid value.
What fails:
X-Frame-Options: denied
What passes:
X-Frame-Options: DENY
Example 3: Using Modern CSP Approach
Scenario: Using the modern CSP frame-ancestors directive instead of X-Frame-Options.
What passes:
Content-Security-Policy: frame-ancestors 'none';
This is the modern approach and provides more flexibility than X-Frame-Options.
How PixyScan detects this
PixyScan checks whether your website has protection against clickjacking attacks by declaring either the X-Frame-Options HTTP header or the frame-ancestors directive in the Content-Security-Policy header.
Detection process
PixyScan follows these logical steps to identify clickjacking protection issues:
-
Check for X-Frame-Options header - PixyScan looks for the
X-Frame-Optionsheader in the HTTP response. -
Validate X-Frame-Options value - If the header is present, PixyScan checks if the value is a recognized directive:
DENY(page cannot be embedded in any iframe)SAMEORIGIN(page can only be embedded by same-origin pages)
-
Check for CSP frame-ancestors - PixyScan also checks if the
Content-Security-Policyheader includes aframe-ancestorsdirective, which is the modern replacement forX-Frame-Options. -
Verify protection - PixyScan considers the page protected if either:
X-Frame-Optionsheader is present with a valid value, ORContent-Security-Policyheader includesframe-ancestorsdirective
When the issue is flagged
The issue is flagged when any of these conditions are met:
- Neither
X-Frame-Optionsnor CSPframe-ancestorsis present X-Frame-Optionsis present but has an invalid or unrecognized value (e.g., misspelled or using deprecatedALLOW-FROM)
When the issue passes
The issue passes when:
- The
X-Frame-Optionsheader is present withDENYorSAMEORIGINvalue, OR - The
Content-Security-Policyheader includes aframe-ancestorsdirective - The header value is correctly spelled and cased