Diagram showing a misleading page, a framed site control, and a click reaching that control
Clickjacking path: a misleading page can cover a control in a framed site.
Three steps to review frame policy, test an embed, and verify the action
Test path: check the policy, try an untrusted parent, then verify the action.

01Issue

Overview

A browser can show one website inside a frame on another website. Clickjacking, also called UI redressing, takes advantage of this by placing the real site beneath a misleading page. The visitor thinks they are clicking the visible page, but the click reaches a control in the framed site. If the visitor is signed in and the browser sends the session with that action, the site may carry it out as the visitor. A page loading in a frame is only a starting clue; the risk depends on what a visitor can do there. Related attacks such as double-clickjacking use a different interaction and are not stopped by frame restrictions alone. OWASP Clickjacking Defense Cheat Sheet

Common causes

  • A sensitive page does not say which sites are allowed to frame it.
  • A framing rule is missing from some routes, redirects, or error pages, or an edge proxy removes it.
  • The site uses frame-src when it needs frame-ancestors; the first controls frames loaded by the site, while the second controls who may frame the site.
  • A page relies on an old JavaScript frame-breaker instead of a browser-enforced response policy.
  • A sensitive action can be completed with one click and has no clear review or confirmation step.

References: OWASP WSTG: Testing for Clickjacking ↗OWASP Clickjacking Defense Cheat Sheet ↗MDN: CSP frame-ancestors ↗MDN: X-Frame-Options ↗

02Examples

EXAMPLE

Illustrative test page hosted on a separate, controlled origin, https://embed.example.test/, can contain <iframe src="https://app.example.test/account/settings" title="Clickjacking test"></iframe>. This checks whether the browser can display the target page in a frame; it does not show that an action can be triggered.

Illustrative response for a page that should not be embedded:

HTTP/1.1 200 OK

Content-Security-Policy: frame-ancestors 'none';

X-Frame-Options: DENY

The first header is the main framing policy. The second is a compatible fallback for older browsers. If the page must be embedded by the same site, use frame-ancestors 'self'; if a partner needs to embed it, list that exact trusted origin.

This is an HTML page (not XML) that loads the target URL inside a 500 × 500 frame. It checks whether that page can be displayed in a frame; frameability alone does not show that a user can be tricked into activating a control.

CONTROLLED LAB PAYLOAD<html>
    <head>
        <title>Clickjack test page</title>
    </head>
    <body>
        <iframe src="http://www.target.site" width="500" height="500"></iframe>
    </body>
</html>

03Impact

The target page must be frameable from an untrusted site in a browser the visitor uses. There must also be an action worth triggering, and the visitor must be able to reach it while the page is framed. A signed-in session can increase impact when the browser includes it with the action; cookie settings and browser behavior affect that condition.

If a visitor is misled into activating a control, the application may perform an action using that visitor’s permissions, such as changing a setting, approving a request, or submitting a transaction. The actual impact depends on the control, whether fresh confirmation is required, and whether the resulting state change is verified. Frameability by itself does not establish account changes or other harm.

04Testing

Test cases

1. Check whether a framed page exposes a meaningful action

Load a sensitive test page from a separate controlled origin. Check a reversible test action and, where appropriate, whether an overlapping decoy can cause the click to reach that action; inspect the resulting state and any confirmation step.

Example: A page loading in a frame is a clue. A verified action shows its effect; a controlled click-through also shows whether a misleading overlay can trigger it.

<iframe src="https://app.example.test/account/settings" width="500" height="500"></iframe>

2. Compare trusted and untrusted framing origins

Inspect the final response’s Content-Security-Policy frame-ancestors and X-Frame-Options headers. Try the same page from an approved parent and an unrelated parent in supported browsers.

Example: A partner may be allowed to embed a page intentionally. The browser decides whether a particular parent can frame it.

GET /account/settings HTTP/1.1
Host: app.example.test

3. Check nested parents and session behavior

Where nested frames are used, compare each ancestor with the policy. Repeat with signed-in and signed-out test sessions and inspect whether cookies are sent.

Example: Different schemes and ports form different origins. A missing cookie in one browser does not prove the page cannot be framed.

Testing references: OWASP WSTG: Testing for Clickjacking ↗OWASP Clickjacking Defense Cheat Sheet ↗MDN: CSP frame-ancestors ↗MDN: X-Frame-Options ↗

05Mitigation

Set Content-Security-Policy: frame-ancestors 'none' on pages that should never be embedded. Use frame-ancestors 'self' or a short list of exact trusted origins when embedding is required. This directive must be sent as an HTTP response header; putting it in a <meta> element has no effect. It also does not fall back to default-src, so set it explicitly. Add a matching X-Frame-Options: DENY or SAMEORIGIN fallback when older browser support is needed, and do not use the obsolete ALLOW-FROM value. Apply the policy consistently at the application or trusted edge. SameSite=Lax or Strict on session cookies can reduce cross-site cookie use in frames, but it does not replace the framing policy. For high-impact actions, add a clear review step or re-authentication as another layer.

Retest

Repeat the frame checks from approved and unapproved origins in supported browsers. Confirm the response headers survive redirects and errors, nested frames obey the policy, and approved embedding still works. Recheck any sensitive test action and confirm the intended state cannot be changed from an unapproved frame.