Skip to content
cloudgrip

$ man graphql-introspection

//Attacks and vulnerabilities

What is GraphQL introspection?

GraphQL introspection is a built-in feature that lets a client ask a GraphQL server to describe its own schema: every type, field, argument, query and mutation. Left open in production, it gives an attacker a full map of the API to probe.

  • Attacks and vulnerabilities
  • 3 min read
  • updated Nov 11, 2026

How it works

Introspection is part of the GraphQL specification. Every GraphQL server understands a few special fields, mainly __schema and __type, that return information about the API instead of data from it. Developer tools use them to offer autocomplete, documentation and query builders.

A client sends an ordinary GraphQL request whose query asks about the schema. The server answers with a structured description of what it can do. Unless the server is configured otherwise, anyone who can reach the endpoint can ask.

Introspection is a feature and not a bug. It becomes a security concern when it is open to the internet for an API that was never meant to be public.

What it looks like

This request asks the server to list its mutations, the operations that change data:

output
POST /graphql HTTP/1.1
Host: api.acme.test
Content-Type: application/json

{"query": "{ __schema { mutationType { fields { name } } } }"}

A server with introspection enabled replies with the full list:

output
{"data": {"__schema": {"mutationType": {"fields": [
  {"name": "updateProfile"},
  {"name": "refundPayment"},
  {"name": "setMemberRole"},
  {"name": "exportAuditLog"}
]}}}}

The front end may only ever call updateProfile. The attacker now knows that refundPayment, setMemberRole and exportAuditLog exist.

Why it matters to an attacker

Introspection removes the guessing. With a REST API, an attacker discovers endpoints one by one. With an open schema, every operation is listed, including internal and deprecated ones, which makes shadow API functionality easy to find.

The schema itself is rarely the vulnerability. It points to where the real ones may be:

What disabling it does and does not do

Turning introspection off in production takes the map away from casual attackers and automated tools. It is worth doing for private APIs, and it is not an access control.

The schema leaks in other ways. Many servers answer a misspelled field with a hint such as "Did you mean refundPayment?", and tools can use those hints to rebuild much of the schema. The front-end JavaScript and the mobile app contain every query the product uses. An attacker who knows an operation name can call it whether or not introspection is on.

If an operation is unsafe when its name is known, it is unsafe.

How to test for it

  1. Find the endpoint. Common paths are /graphql, /api/graphql and /query. Check staging hosts too.
  2. Send an introspection query, first without a session and again as an ordinary user.
  3. Try variations if it is refused. Send the query as a GET request to check whether the block is a real server setting or a fragile filter.
  4. Check for field suggestions by sending a slightly misspelled field name.
  5. Test authorization on what the schema reveals. This step produces the real findings.

Open introspection on its own is a low-severity or informational finding.

How to fix it

Disable introspection where it is not needed, and make sure nothing depends on the schema being secret. Most servers have a switch. Apollo Server, for example, accepts an introspection: false option.

The control that matters is authorization inside every resolver:

output
const resolvers = {
  Mutation: {
    refundPayment: async (_parent, { paymentId, amount }, ctx) => {
      // Enforced on the server, so knowing the mutation name is not enough.
      if (!ctx.user?.roles.includes("billing_admin")) {
        throw new GraphQLError("Not allowed", { extensions: { code: "FORBIDDEN" } });
      }
      return ctx.billing.refund(paymentId, amount, ctx.user.workspaceId);
    },
  },
};

Further hardening:

  • Turn off field suggestions in production error messages.
  • Use an allowlist of known queries, often called persisted queries, if only your own clients should call the API.
  • Limit query depth and cost so nested queries cannot exhaust the server.
  • Remove unused fields and mutations from the schema.

A public API that publishes its schema on purpose can leave introspection on. Then all protection rests on authorization, as described under API security.

See what an attacker would find.

Give us a URL and two test logins. If there’s something to find, your first exploited findings land within 24 hours.

You talk to the people who build Hydra and Cerberus. No sales script.

or write to founders@cloudgrip.ai