What is clickjacking?
Clickjacking is an attack where a malicious page loads your site in an invisible frame and tricks a visitor into clicking buttons on it without knowing. It works only if your site allows itself to be embedded, and is stopped with a header that forbids framing.
How it works
The attacker builds a page with a tempting button, such as a prize or a play icon, and places your page above it in an iframe with opacity set to zero. The visitor thinks they click the decoy, but the click lands on your real page, for example on a "delete account" or "confirm payment" button while they are logged in. Because your page runs in the visitor's own session, the action is accepted. The defence is to tell the browser that your pages must not be shown inside frames from other sites.
<!-- On the attacker's page -->
<iframe src="https://your-app.example/settings"
style="opacity:0; position:absolute; top:0; left:0"></iframe>
<button style="position:absolute">Claim your prize</button>How to tell if your site is affected
- Your pages send neither a frame-ancestors directive in the Content-Security-Policy nor an X-Frame-Options header.
- You can load your own page inside an iframe on a test page you control and it displays.
- Pages with one-click actions (confirm, delete, authorise, pay) are framable.
- frame-ancestors is set to * or to a very wide list of hosts.
How to fix it
Send Content-Security-Policy: frame-ancestors 'none' on pages that never need to be embedded, or 'self' if only your own pages frame them.
Also send X-Frame-Options: DENY (or SAMEORIGIN) as a fallback for very old browsers.
If a widget must be embeddable, allow only specific origins: frame-ancestors https://partner.example.
Next.js: add the headers in next.config.js headers(). Express: use helmet, which sets both by default. nginx: add_header. WordPress: send the header from the server, since most themes do not.
Require re-authentication or confirmation for destructive actions.
How ScanAnt checks for it
The free quick scan reads the response headers of your page and reports when neither X-Frame-Options nor a frame-ancestors directive is present, or when it allows every origin. It does not attempt to frame your site and does not check individual sensitive pages behind a login.
Questions
Is clickjacking a serious vulnerability?
It depends on what a single click on your page can do. For a login-protected app with one-click actions it matters. For a brochure site with no actions it is low risk, but the fix is one header.
X-Frame-Options or frame-ancestors?
Use frame-ancestors, which is the current standard and more flexible. Keep X-Frame-Options as a fallback for old browsers.
Does a JavaScript frame-buster work?
Not reliably. Attackers can block such scripts with the iframe sandbox attribute, so headers are the correct fix.
Will this break embedding on my own site?
Only if you embed your pages in other origins. frame-ancestors 'self' keeps same-origin frames working.
Related terms
Content Security Policy (CSP)
A header that limits which scripts and resources a page may load.
Read →CSRF
Another site makes a logged-in user's browser act on your site.
Read →HSTS
Tells browsers to use only HTTPS for your domain.
Read →Check your own site
Is your CSP, HSTS, framing and referrer policy set up properly?
Open the matching check →
See if your site is affected
Free for any public site, no signup. Need the verified or deep scan? Choose the level on the scan page.
Choose a scan level →