Introspection is a powerful feature in GraphQL, designed to expose the full schema to clients for convenience and tooling.

But when left enabled in production, it offers attackers a blueprint of your internal API design — often more revealing than source code.

In this post, we’ll walk through how to weaponize GraphQL introspection for offensive security assessments.


1. What Is Introspection?

It allows querying the GraphQL server for its own schema:

query {
  __schema {
    types {
      name
      fields {
        name
      }
    }
  }
}

Response reveals:

  • All available queries and mutations
  • Field names, input types, return types
  • Relationships, enum values, descriptions

2. Why It Matters in Offensive Security

When enabled, introspection turns black-box APIs into white-box targets.

Benefits for attackers:

  • Discover hidden functionality (admin-only queries, debug fields)
  • Reveal sensitive data models (user roles, permissions, payment tokens)
  • Map internal microservices via field names
  • Automate attack surface expansion

3. Extracting the Full Schema

Option A: Manual Querying

Use Burp Repeater or Postman:

{
  "query": "{ __schema { types { name fields { name type { name kind } } } } }"
}

Option B: Tooling

GraphQL Voyager

  • Converts introspection result into an interactive graph

InQL Scanner (Burp)

  • Burp extension that maps and enumerates endpoints
  • Sends fuzz payloads to known fields automatically

graphql-introspection-cli

graphql-introspection https://target.com/graphql > schema.json

4. What to Look For

🧠 Field Hints

Look for names like:

  • debugLog, adminUsers, resetPasswordToken, configSettings

🔐 Unintended Exposure

  • Private fields that bypass access control
  • Mutation endpoints that change state (deleteUser, upgradeAccount)
  • Enum values that define internal roles (SUPERADMIN, STAFF_INTERNAL)

💥 Chaining Targets

  • Input types that accept file, url, or command parameters
  • Fields with high nesting depth → DoS
  • Connections between types that enable overreach

5. Real-World Exploitation Flow

  1. Confirm introspection is enabled
  2. Extract and analyze full schema
  3. Identify high-value fields
  4. Send crafted queries via Burp Repeater or GraphQL Raider
  5. Validate behavior, escalate to abuse

6. How to Defend

  • Disable introspection in production
if (process.env.NODE_ENV === 'production') {
    introspection: false
  }
  • Use schema whitelisting and RBAC per field
  • Monitor introspection attempts — they often signal reconnaissance
  • Rate-limit large or deeply nested queries

Final Thoughts

Introspection isn’t just metadata — it’s attack surface amplification.

Leaving it exposed in production is equivalent to handing out internal API docs to strangers.

In the hands of a skilled operator, introspection turns uncertainty into a surgical strike plan.

Next: abusing field-level access misconfigurations discovered via introspection.

Map the schema. Decode the logic. Strike with context.