← Back to sandbox
Security — UI Beginner 5 possible tests

Clickjacking

Four endpoints with different framing policies. Check which ones are missing X-Frame-Options and Content-Security-Policy headers, then see the unprotected page load live inside a hostile iframe.

What is Clickjacking?

An attacker embeds the target page inside a transparent <iframe> layered over a decoy page. The victim sees the decoy but their clicks land on the invisible target — deleting accounts, confirming purchases, or changing passwords without consent. The fix is one response header: X-Frame-Options: DENY or Content-Security-Policy: frame-ancestors 'none'.

What is hidden here

Bug FoundUnprotected endpoint — no framing header present, embeddable from any origin
True PositiveX-Frame-Options: DENY — browser refuses to render the page in any iframe
True PositiveX-Frame-Options: SAMEORIGIN — blocks cross-origin framing, allows same-origin
True PositiveContent-Security-Policy: frame-ancestors 'none' — modern equivalent of DENY
Bug FoundLive iframe demo — unprotected page loads inside an embedded iframe, demonstrating the attack surface

Test 1 — Unprotected Endpoint

Fetches the endpoint and inspects the response headers. An endpoint with no framing protection can be embedded in an iframe on any domain.

✗ No framing headers
Response Headers

Test 2 — X-Frame-Options: DENY

The strongest framing restriction. The browser refuses to render this page in any iframe regardless of the requesting origin — including the same domain.

✓ X-Frame-Options: DENY
Response Headers

Test 3 — X-Frame-Options: SAMEORIGIN

Allows framing from the same origin only. Any attempt to embed this page from a different domain is blocked. Weaker than DENY but suitable when the app itself needs to embed the page.

✓ X-Frame-Options: SAMEORIGIN
Response Headers

Test 4 — CSP: frame-ancestors 'none'

The modern replacement for X-Frame-Options. The Content-Security-Policy directive frame-ancestors 'none' blocks all framing and supersedes X-Frame-Options in browsers that support CSP Level 2.

✓ Content-Security-Policy: frame-ancestors 'none'
Response Headers

Test 5 — Live Iframe Embed

Embeds the unprotected endpoint inside a real iframe. In a real attack, this iframe would be made transparent and positioned over a decoy page — the victim clicks what they think is the attacker's button but actually activates the action below.

✗ Unprotected — embeds successfully
iframe (attacker-controlled)
🔒 Framing blocked by browser

  • Click Test 1 — the response carries no X-Frame-Options or Content-Security-Policy framing directive. Any origin can embed this page (bug found).
  • Click Test 2 — the X-Frame-Options: DENY header is present. The browser blocks framing from all origins including the same domain (true positive — strongest protection).
  • Click Test 3 — the X-Frame-Options: SAMEORIGIN header is present. The browser allows framing from the same origin only; any other domain is blocked (true positive — partial protection).
  • Click Test 4 — the response carries Content-Security-Policy: frame-ancestors 'none'. This is the modern CSP-based equivalent of DENY and supersedes X-Frame-Options in compliant browsers (true positive).
  • Click Test 5 — the unprotected page renders inside a live iframe on this page, confirming an attacker could embed it transparently over a decoy and intercept user clicks (bug found).