--- name: clickjacking description: >- Clickjacking playbook. Use when testing whether target pages can be framed, whether X-Frame-Options or CSP frame-ancestors are properly configured, and whether UI redress attacks can trigger sensitive actions. --- # SKILL: Clickjacking — Expert Attack Playbook > **AI LOAD INSTRUCTION**: Clickjacking (UI redress) techniques. Covers iframe transparency tricks, X-Frame-Options bypass, CSP frame-ancestors, multi-step clickjacking, drag-and-drop attacks, and chaining with other vulnerabilities. Often a "low severity" finding that becomes critical when targeting admin actions. ## 1. CORE CONCEPT Clickjacking loads a target page in a transparent iframe overlaid on an attacker's page. The victim sees the attacker's UI but clicks on the invisible target page, performing unintended actions. ```html
``` --- ## 2. DETECTION — IS THE PAGE FRAMEABLE? ### Check X-Frame-Options Header ``` X-Frame-Options: DENY → cannot be framed (secure) X-Frame-Options: SAMEORIGIN → only same-origin framing (secure for cross-origin) X-Frame-Options: ALLOW-FROM uri → deprecated, browser support inconsistent (header absent) → frameable! (vulnerable) ``` ### Check CSP frame-ancestors ``` Content-Security-Policy: frame-ancestors 'none' → cannot be framed Content-Security-Policy: frame-ancestors 'self' → same-origin only Content-Security-Policy: frame-ancestors https://a.com → specific origin (directive absent) → frameable ``` **CSP frame-ancestors supersedes X-Frame-Options** in modern browsers. ### Quick PoC Test ```html ``` If the page loads in the iframe → frameable → potentially vulnerable. ### JavaScript Frame Detection (from target page source) ```javascript // Common frame-busting code found in target pages: if (top.location.hostname !== self.location.hostname) { top.location.href = self.location.href; } ``` If this code is present but not using CSP `frame-ancestors`, it can often be bypassed. --- ## 3. PROOF OF CONCEPT TEMPLATES ### Basic Single-Click ```html