# Clickjacking

> Tricking you into clicking something on a hidden page layered under a decoy.

- Level: Advanced
- Topics: Security
- URL: https://tidbit.legios.com.ar/clickjacking/
- In Spanish: [Clickjacking](https://tidbit.legios.com.ar/es/clickjacking/)

**Clickjacking** hides a real website inside an invisible frame on top of a bait page. The victim sees a harmless button, like "Play video" or "Claim your prize", but the click actually lands on a button of the hidden page: "Delete account", "Confirm transfer", "Allow camera". Because the victim is already logged in to that site in the same browser, the action runs with their session. The name was coined in 2008 by researchers Jeremiah Grossman and Robert Hansen; it is also called UI redressing.

The trick needs only standard web pieces: an `<iframe>` that loads the target page, CSS that makes it fully transparent and positions it precisely, and a lure that makes people click in the right spot. Variants hijack "Like" buttons (likejacking) or chain several clicks into a little game. It is a cousin of CSRF: both abuse the fact that the browser sends your cookies to a site even when another page started the action, but in clickjacking you click yourself.

The fix is on the target site, and it is simple: tell browsers not to show your pages inside frames from other origins. The modern way is the Content Security Policy header `frame-ancestors 'none'` (or a list of allowed origins); the older header `X-Frame-Options: DENY` or `SAMEORIGIN` does the same for legacy browsers. Cookies marked `SameSite` add another layer, since the framed page then loads without your session. Sensitive actions that ask for a password or a second confirmation are also harder to hijack.

## An analogy

Someone slides a sheet of carbon paper under the raffle ticket you are signing. You think you are writing your name on a raffle stub, but the pen is also signing a check underneath.

## Keep in mind

- The real page sits in a transparent frame on top of a decoy.
- Your click runs with your logged-in session on the hidden site.
- CSP frame-ancestors or X-Frame-Options blocks framing.
- The defense lives on the target site, not on the user's side.

## Go deeper

- [Clickjacking (OWASP)](https://owasp.org/www-community/attacks/Clickjacking)
- [Clickjacking (MDN Web Docs)](https://developer.mozilla.org/en-US/docs/Web/Security/Attacks/Clickjacking)
- [Clickjacking Defense Cheat Sheet (OWASP)](https://cheatsheetseries.owasp.org/cheatsheets/Clickjacking_Defense_Cheat_Sheet.html)

## Related terms

- [Website](https://tidbit.legios.com.ar/website/): A set of web pages under one address, stored on a server and opened in a browser.
- [Web browser](https://tidbit.legios.com.ar/web-browser/): The app that fetches web pages from the internet and draws them on your screen.
- [CSS](https://tidbit.legios.com.ar/css/): The language that decides how a web page looks: colors, fonts, spacing, layout.
- [CSRF](https://tidbit.legios.com.ar/csrf/): An attack that makes your browser send a request you never meant to send, as you.
- [Cookies](https://tidbit.legios.com.ar/cookies/): Small notes a website asks your browser to keep, so it can recognize you later.
