Clickjacking
The attacker loads the victim site in an invisible iframe over their own page and tricks the user into clicking where they don’t expect (UI redressing). That click runs an action with the victim’s session: change a setting, accept a permission, confirm a payment, give a “like” (likejacking) or even type (cursorjacking). There’s no code injection: it abuses the fact that the browser delivers the event to whichever layer sits at those coordinates, not to the one the user thinks they’re pressing.
flowchart LR
A[Victim] -->|"clicks the decoy"| L[Attacker page]
L -. "opacity-0 iframe overlaid" .-> V["Real button on victim.tld<br/>(active session)"]
A -->|"the click passes through the iframe"| V
V -->|"action with the victim's session"| R["Setting / permission / payment"]
Threat model
Section titled “Threat model”What the attacker gains is executing a one-click or drag action on the victim’s behalf, inside their authenticated session. Chained with flows that ask for no confirmation, it leads to: account changes (email, 2FA), granting permissions in an OAuth consent, data deletion, or a payment. The limit is the action’s complexity: the more clicks or typed data it needs, the harder (but not impossible, with multi-step or drag-and-drop).
Anatomy
Section titled “Anatomy”It only works if the victim page allows framing. The invariant the attack breaks is
“the user consciously clicks the control they see”: the attacker dissociates what is
seen (their decoy) from what receives the click (the iframe’s real button). To do
so they overlay the victim iframe with opacity:0 and a high z-index, aligned pixel by
pixel with the cursor, so the decoy click lands on the real button. The browser doesn’t
read intent: it delivers the event to the top layer at those coordinates.
The defense is declarative and server-side: if the response carries
Content-Security-Policy: frame-ancestors or X-Frame-Options, the browser refuses to
frame and the attack dies at the source. See security headers.
Variants
Section titled “Variants”- Classic clickjacking — one click on a sensitive button (delete account, approve).
- Likejacking — stealing “like”/follow clicks on social networks.
- Cursorjacking — faking the cursor position so the real click lands far from where the user thinks.
- Drag-and-drop / content extraction — dragging a value (reflected token, text) into an iframe field, or extracting text from the iframe to the attacker domain.
- Multi-step — several chained clicks (e.g. open a menu and confirm).
- Double framing — nesting iframes to bypass JavaScript-based frame busting.
Red Team
Section titled “Red Team”Discovery
Section titled “Discovery”Check whether a page with sensitive actions returns anti-framing headers. If it does not, it’s a candidate:
GET /settings HTTP/1.1Host: victim.tld
HTTP/1.1 200 OKContent-Type: text/html# Missing these? Then it can be framed:# X-Frame-Options: DENY# Content-Security-Policy: frame-ancestors 'none'Automate it at scale with curl over your list of authenticated routes:
curl -sD - -o /dev/null https://victim.tld/settings/delete-account \ | grep -iE 'x-frame-options|frame-ancestors' || echo "FRAMABLE"Exploitation — PoC
Section titled “Exploitation — PoC”Minimal PoC overlaying the real iframe under a decoy:
<!doctype html><style> iframe { opacity:0.0; position:absolute; top:0; left:0; width:1000px; height:800px; z-index:2; border:0 } #lure { position:absolute; top:410px; left:360px; z-index:1; font:bold 20px sans-serif }</style><div id="lure">Click to win a prize</div><iframe src="https://victim.tld/settings/delete-account"></iframe>Raise opacity to 0.2 only while developing to align the decoy over the real button;
drop it to 0 for the final PoC. For multi-step actions, chain decoys (multi-click) or use
drag-and-drop: the user drags a “gift” and actually drops a value onto an iframe field.
Researcher workflow
Section titled “Researcher workflow”- Identify an action with real effect (delete, approve, change email/2FA, accept an
OAuth consent) served without
frame-ancestors. - Frame it and align the decoy with
opacity:0.2. - Verify that one click executes the action with your test session.
- Drop opacity to 0 and document: that’s the impact proof.
Bypassing weak “frame busting”
Section titled “Bypassing weak “frame busting””Old scripts (if (top != self) top.location = self.location) are bypassed with the iframe
sandbox attribute without navigation permission (allow-scripts minus
allow-top-navigation) or double framing. The iframe csp attribute does not work for
this: the framed origin would have to opt into that CSP; the attacker can’t impose it.
<!-- Without allow-top-navigation, the frame-buster can't relocate the window --><iframe sandbox="allow-forms allow-scripts" src="https://victim.tld/action"></iframe>The takeaway: the reliable defense is the headers, not JavaScript.
Tooling
Section titled “Tooling”Burp Clickbandit (auto-generates PoCs by recording the clicks), and the browser with
DevTools to fine-tune the overlay. To hunt missing headers at scale, nuclei and curl.
Impact and chaining
Section titled “Impact and chaining”A framed click on an OAuth consent can grant a malicious app (see OAuth); on a flow without re-authentication, it can change the recovery email and lead to ATO. The final impact is always that of the framed action.
Blue Team
Section titled “Blue Team”Detection
Section titled “Detection”Sensitive pages served without frame-ancestors/X-Frame-Options. Periodic header
auditing across all routes (not just the home page) is the main detection; in
production, alert if an authenticated route loses the header after a deploy.
Telemetry and sources
Section titled “Telemetry and sources”Header scanners in CI/CD, proxy/WAF logs, and CSP reports if you configure
report-to/report-uri with frame-ancestors (framing attempts generate reportable
violations).
Hardening
Section titled “Hardening”Content-Security-Policy: frame-ancestors 'none'(or allowed origins) — the modern, preferred defense, applied site-wide.X-Frame-Options: DENY(orSAMEORIGIN) for old browsers.SameSite=Lax/Strictcookies: make it harder for the framed action to carry the session.- Confirmation / re-authentication on sensitive actions (one click isn’t enough).
Response
Section titled “Response”Add the headers globally (filter/middleware, not page by page), review which actions lacked confirmation and, if there was a campaign, warn affected users.
CVEs and real-world cases
Section titled “CVEs and real-world cases”- Likejacking on social networks (rampant theft of “like” clicks via invisible iframes) was endemic around 2010-2011.
- Clickjacking usually has no CVE of its own: it stems from missing configuration
(
frame-ancestors/X-Frame-Options). It remains a common bug-bounty finding, with impact proportional to the framable action (account changes, consents).
Product incidents and advisories in NVD (https://nvd.nist.gov/vuln/search) and GitHub Advisories (https://github.com/advisories).
Testing checklist
Section titled “Testing checklist”- Can the page be framed? (no
frame-ancestors/X-Frame-Options). - Clickjacking PoC over an action with real effect (not an informational page).
- Frame busting (if any) and its bypass tested.
- Drag-and-drop / multi-step evaluated if one click isn’t enough.
- Chaining evaluated (OAuth consent, email/2FA change).