Skip to main content
Cautionary Tale5 min read

The Invisible Button Trick That Steals Clicks: How Clickjacking Overlays Work

By The bee2.io Engineering Team at bee2.io LLC

Illustration for: The Invisible Button Trick That Steals Clicks: How Clickjacking Overlays Work

The Invisible Button Trick That Steals Clicks

Imagine someone puts a perfectly transparent sheet of glass over your favorite restaurant's menu. You can't see it, but when you reach for the pizza slice, you're actually clicking on a link that signs you up for cryptocurrency courses. That's clickjacking - except the glass is an invisible iframe and the prank is actually malicious.

Welcome to one of the web's most elegantly terrible security problems. It's the kind of attack that makes you feel dumb for falling for it, like you just got pranked by a 12-year-old with too much free time and a CS degree. Here's the thing: clickjacking overlays are still absolutely wrecking websites in 2026, and most developers have no idea their site is basically a victim waiting to happen.

How Clickjacking Overlays Actually Work (And Why It's Genius-Level Evil)

Let me break down this attack like you're at a party and I'm three drinks deep into explaining why your website's security is held together with duct tape and prayers.

A clickjacking attack loads your entire website inside an invisible iframe - think of it as a ghost copy of your site layered on top of something else. An attacker then positions invisible buttons or links right where your actual legitimate buttons are. When users click what they think is "Like My Tweet," they're actually clicking an invisible button that does something terrible - like changing their email address, approving a transaction, or granting browser permissions to access their camera.

The beauty of this attack, if you can call psychological manipulation "beauty," is that it's utterly invisible. Industry data shows that clickjacking attempts increased by roughly 42% year-over-year through 2024-2025, and most victims never realize they've been hit. Your users click, something weird happens, they blame their browser or their internet, and the attacker walks away with whatever they wanted.

Here's the insult to injury: this attack doesn't require any fancy zero-days or secret backdoors. It's just... embedding your site in a frame and layering stuff on top. It's like someone broke into your house by asking you to leave the door open while they delivered a pizza.

The Clickjacking Frame Attack in Action

An attacker creates a webpage with invisible iframes stacked on top of each other. Your site lives in one of those frames, completely invisible to the user. On top of that, they position transparent buttons and links that overlap with your real interactive elements. Users see what looks like a normal website (maybe a game, a video, or a survey), but every click goes somewhere it shouldn't.

The result? Users accidentally:

  • Approve OAuth permissions they never wanted to grant
  • Change password settings on their bank accounts
  • Purchase things they definitely didn't intend to buy
  • Share posts that make their friends question their judgment

X-Frame-Options and CSP Frame-Ancestors: Your Invisible Shield (Finally, Something Invisible That's Good)

Here's where we get to the part where you actually fix this instead of just being terrified.

Two HTTP headers can basically end clickjacking attacks: X-Frame-Options and CSP frame-ancestors. These are like saying "You cannot embed my website in your iframe. Period." Turns out, that's a surprisingly effective security strategy.

X-Frame-Options: The OG Defense

X-Frame-Options has been around since the dinosaur ages of web security (like 2009, which is basically the Jurassic period in tech years). It's a simple header that tells browsers: "Don't let anyone embed this page in a frame."

You've got three options:

  • DENY - Absolutely nobody can frame your site. Not even other pages on your own domain. It's scorched earth. Very effective, slightly nuclear.
  • SAMEORIGIN - Only your own domain can frame it. Reasonable. Practical. The Goldilocks option.
  • ALLOW-FROM [URL] - Let specific trusted domains frame your site. Deprecated, but some old browsers still respect it. Using it is like keeping your flip phone "just in case."

Set it in your response headers like this: X-Frame-Options: SAMEORIGIN and you've just blocked 99% of clickjacking attempts. It's stupidly simple, which is why it's shocking how many major websites don't bother.

CSP Frame-Ancestors: The Modern Solution

Content Security Policy's frame-ancestors directive is basically X-Frame-Options' smarter, better-dressed younger sibling. It does the same job but integrates with your broader Content Security Policy, which is like having a security system instead of just a deadbolt.

Use it like this: Content-Security-Policy: frame-ancestors 'self'

This tells every browser made after 2015 that your site can only be embedded by itself. Modern browsers will listen to this. Old browsers will ignore it, but those users are probably using internet explorer anyway, so they've already surrendered to chaos.

Pro tip: Use both headers. X-Frame-Options covers older browsers, CSP covers everyone else. It's belt-and-suspenders security, which is exactly the kind of paranoid redundancy that actually works.

Time to Audit Your Own Site (Before Someone Else Does)

Here's where I tell you to stop reading this blog post and actually check your own website's headers. Seriously. Go look. I'll wait.

SCOUTb2 can scan your site and tell you whether you're vulnerable to clickjacking in about thirty seconds - way faster than manually checking HTTP headers while pretending to understand cURL commands. You'll get a report showing whether your X-Frame-Options and CSP directives are actually set, or whether your site is currently available for embedding by literally anyone with a basic understanding of HTML.

This is the kind of thing that seems boring and unnecessary until the day it isn't. Fix it now, sleep well tonight.

Disclaimer: This article is for informational purposes only and does not constitute legal, professional, or compliance advice. SCOUTb2 is an automated scanning tool that helps identify common issues but does not guarantee full compliance with any standard or regulation.

securityclickjackingX-Frame-OptionsCSP

Stop finding issues manually

SCOUTb2 scans your entire site for accessibility, performance, and SEO problems automatically.