Clickjacking
Clickjacking is an attack that tricks users into clicking on something different from what they perceive, usually by overlaying invisible iframes.
Methodology
Black Box Testing
Visit all pages of the application and note the response headers.
Look for the following headers:
X-Frame-Options
Content-Security-Policy
Evaluate the headers:
If
X-Frame-Options
is set toDENY
orSAMEORIGIN
, the application is likely not vulnerable to clickjacking.If the
Content-Security-Policy
header includes theframe-ancestors
directive and it is set to'none'
or'self'
, the application is also likely protected.
If the
frame-ancestors
directive contains a domain (e.g.,*.trusted.com
), review it for:Wildcard configurations
Misconfigurations or overly permissive policies
Test any identified instances where framing is allowed to verify clickjacking vulnerabilities.
White Box Testing
Identify the framework used by the application.
Identify existing defenses related to clickjacking.
Identify any libraries used to configure security headers.
Review the header configurations and ensure they are set securely.
Test the identified instances of clickjacking and develop proof-of-concept exploits where applicable.
POC - Basic clickjacking with CSRF token protection
POC - Clickjacking with form input data prefilled from a URL paramete
POC - Bypass frame breaking scripts protections
A common client-side protection enacted through the web browser is to use frame busting or frame breaking scripts. An effective attacker workaround against frame busters is to use the HTML5 iframe sandbox
attribute. Both the allow-forms
and allow-scripts
values permit the specified actions within the iframe but top-level navigation is disabled. This inhibits frame busting behaviors while allowing functionality within the targeted site.
If see This page cannot be framed
use sandbox="allow-forms
to bypass it
POC -Exploiting clickjacking vulnerability to trigger DOM-based XSS
POC - Multistep clickjacking
Last updated