Clickjacking
Clickjacking is an attack that loads your page in a hidden frame on another site. The visitor thinks they click the visible page, but the click goes to your page.
Security attack
Also called UI redressing
Updated
On this page
Example
- 01The visitor sees the bait page and its button.
- 02Your page sits on top in an invisible iframe.
- 03The click lands on your "Delete account" button.
How to prevent it
Tell browsers which sites may frame your page. Send CSP frame-ancestors. Also send X-Frame-Options for old browsers.
# Only your own site may frame this page Content-Security-Policy: frame-ancestors 'self' X-Frame-Options: SAMEORIGIN # Or: no site may frame this page Content-Security-Policy: frame-ancestors 'none' X-Frame-Options: DENY
To allow a partner, list it in frame-ancestors, for example 'self' https://partner.example. X-Frame-Options cannot list sites.
Learn more
Sources