Track 08 · Lesson 9 of 20Attacks and defenses

Track 08 · Attacks and defenses

Clickjacking

Lesson 9 of 20· 5 min

Clickjacking loads your site in an invisible frame and places it exactly over the attacker’s own button. You think you’re clicking “Claim prize”; you’re really clicking something on your site, where you’re logged in.

Claim your prize

Then slide to reveal what you really clicked

prize-winner.example

🎁 Congratulations! You’re our 1,000,000th visitor.

bank.example response headers

(nothing stops other sites from framing this page)

Click “Claim prize”. Then slide to reveal what you really clicked.

Refuse to be framed#

Content-Security-Policy: frame-ancestors 'none' tells the browser never to show your page inside another site. Use 'self' if you frame your own pages. Older browsers understand X-Frame-Options: DENY, so many sites send both.

Belt and braces for dangerous buttons#

For the most sensitive actions (deleting an account, changing an email, moving money), ask for confirmation in a way an invisible frame can’t fake, like re-entering a password or a one-time code.

Check yourself

Which header stops other sites from framing your page?