Track 08 · Lesson 9 of 20Attacks and defenses
- 01What HTTPS protects
- 02The same-origin policy
- 03CORS
- 04Security headers
- 05Cookies done right
- 06Cross-site scripting (XSS)
- 07Content Security Policy
- 08Cross-site request forgery (CSRF)
- 09Clickjacking
- 10Unsafe URLs and open redirects
- 11Prompt injection
- 12SQL and command injection
- 13Prototype pollution, CRLF and SVG
- 14Server-side request forgery (SSRF)
- 15Remote code execution and denial of service
- 16Spoofed headers
- 17Rate limiting
- 18Cache poisoning
- 19The OWASP Top 10
- 20The attack lab
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