# GraphQL Introspection
> The spec-defined `__schema` / `__type` meta-fields that let a client pull the full type system; for an attacker it is the map of every query, mutation and argument, and disabling it hides the map without closing any door.
## How it works
Introspection is queried with GraphQL itself. Every endpoint also exposes the reserved `__typename` field, which makes the cheapest liveness/identity probe:
```graphql
query{__typename} # any GraphQL endpoint -> {"data":{"__typename":"Query"}}
{__schema{queryType{name}}} # is introspection on?
```
The full `IntrospectionQuery` (Burp and graphql-core's `get_introspection_query()` generate it) returns queries, mutations, subscriptions, types, args, enum values and descriptions. If it fails on an endpoint that answers the probe, strip the legacy `onOperation` / `onFragment` / `onField` directive fields, which many servers reject. In one lab the 1,479-byte standard query returned 26,454 bytes covering 17 types.
Defaults matter: Apollo Server enables introspection unless `NODE_ENV=production`; graphql-core leaves "Did you mean" suggestions on by default.
## Schema recovery when introspection is "off"
| Technique | What it exploits |
|---|---|
| Regex-filter bypass | Filters that match `__schema{` miss `__schema` followed by newline, space or comma, which the GraphQL lexer ignores |
| Alternate transport | Introspection blocked only on JSON POST; retry as `GET /graphql?query=query%7B__schema%0A%7BqueryType%7Bname%7D%7D%7D` or form-urlencoded POST |
| Field suggestions | `Cannot query field 'setRol' on type 'Mutation'. Did you mean 'setRole'?` — also leaks argument names (`Did you mean 'username'?`) and type names. Clairvoyance / clairvoyancex automate full schema rebuild from these hints |
| Recursive suggestion harvest | Seed near-miss names (`usr`, `acount`, `admn`, `paymnt`), add every suggested name back to the wordlist and recurse into its type; wrong-shaped arguments (`user(i: 1)` → `Did you mean "id"?`) leak argument names. `clairvoyance -o schema.json -w wordlist.txt <url>` emits an introspection-shaped schema |
| Error-shape oracle | With suggestions hidden, a real field still errors differently (`Field 'setRole' of type 'User' must have a selection of subfields`) from a fake one (`Cannot query field 'grantAdmin'`) — wordlists still confirm names |
| Client artifacts | Operations seen in proxy history and persisted/bundled queries in front-end JS give real field and argument names |
| Engine fingerprint | graphw00f (and InQL's fingerprinter) identify the engine even with introspection off, pointing at engine-specific defaults and CVEs |
Once you have `schema.json`, mine it rather than just reading it: GraphQL Voyager for relationships, graphql-path-enum to list every path to a type, and the OWASP one-liner to spot Relay `node` entry points:
```bash
jq '.data.__schema.types[] | select(.name=="Query") | .fields[] | .name' schema.json | grep node
```
## Why "disable introspection" is not a fix
A scripted graphql-core 3.2.14 fixture tested four configs for an undocumented `adminUserRecord(id)` field: with introspection disabled but no resolver check, an ordinary user calling the field by name still got another user's email and ID digits; the "Did you mean" hint naming the field appeared in all four configs. Only the resolver authorization check stopped the leak. A separate lab reached the same conclusion with a deliberately unguarded `setRole` mutation: identical result on default, no-introspection and hardened profiles. Treat introspection findings as a precondition that accelerates [[GraphQL Authorization Flaws]], not as impact.
## Notable cases
- **Parse Server CVE-2025-53364** — GraphQL schema served publicly without session token or master key; fix requires the master key, with a temporary `graphQLPublicIntrospection` opt-out.
- **Mass ATO of 29,000 accounts** — production introspection revealed an undocumented `tokenForgotPasswords` query returning live reset tokens plus a PII query exposing users and admins; enumerate → trigger reset → read token → reset.
- **Overgrowth (HI CyberCon CTF 2026)** — introspection off, but validation errors named `resetPassword` and its args; the 4-digit code then fell to [[GraphQL Batching Attacks]].
- **GitLab CVE-2021-4191** — unauthenticated `/api/graphql` (try `/-/graphql-explorer`) returned usernames, names and sometimes emails for the whole user base.
- **Suggestion-based reconstruction (arok.win)** — with `{__schema{...}}` returning "introspection is disabled", suggestions still rebuilt `Query` and `Mutation`; the target is undocumented admin mutations (`deleteUser`, `setRole`, `impersonate`), UI-unselected sensitive fields and deprecated fields with weaker authz.
## Defenses
- Private API: disable introspection (Apollo `introspection: process.env.NODE_ENV !== 'production'`; graphql-core `NoSchemaIntrospectionCustomRule`). Public API: keep it but review the schema for private fields, or gate it behind authn + RBAC as Parse now does.
- Hide suggestions too (Apollo Server v4+: `hideSchemaDetailsFromClientErrors`; graphql-core `hide_suggestions`), and mask verbose errors.
- Safelist operations ([[GraphQL Denial of Service]] covers persisted queries) so unknown fields are never executed.
- None of the above replaces per-resolver authorization.
## Related
- [[GraphQL Security]]
- [[GraphQL Authorization Flaws]]
- [[GraphQL Batching Attacks]]
- [[API Discovery]]
- [[Excessive Data Exposure]]
- [[Reconnaissance]]
## Sources
- [[raw/portswigger.net/graphql-api-vulnerabilities-web-security-academy-2745|GraphQL API Vulnerabilities]]
- [[raw/excessionlabs.ai/graphql-introspection-disabling-it-leaves-the-field-open-14206|GraphQL introspection: disabling it leaves the field open]]
- [[raw/escape.tech/graphql-introspection-security-lessons-from-the-parse-server-vulnerabi-4621|GraphQL Introspection Security: Lessons from the Parse Server Vulnerability]]
- [[raw/blog.assetnote.io/exploiting-graphql-435|Exploiting GraphQL]]
- [[raw/dedsecops.com/confirming-graphql-dast-findings-introspection-batching-depth-cost-csr-14495|Confirming GraphQL DAST findings: introspection, batching, depth/cost, CSRF over GET]]
- [[raw/dev.to/graphql-bola-one-object-many-paths-and-how-to-prove-the-gap-14345|GraphQL BOLA: one object, many paths, and how to prove the gap]]
- [[raw/medium.com/mass-account-takeover-of-29-000-accounts-by-abusing-graphql-13886|Mass account takeover of 29,000 accounts by abusing GraphQL]]
- [[raw/p4ndora.ai/overgrowth-graphql-aliased-mutation-brute-force-of-a-password-reset-hi-14207|Overgrowth: GraphQL aliased-mutation brute force of a password reset (HI CyberCon 2026)]]
- [[raw/rapid7.com/cve-2021-4191-gitlab-graphql-api-user-enumeration-fixed-9502|CVE-2021-4191: GitLab GraphQL API User Enumeration (FIXED)]]
- [[raw/cheatsheetseries.owasp.org/graphql-cheat-sheet-owasp-2815|GraphQL Cheat Sheet]]
- [[raw/github.com/payloadsallthethings-graphql-injection-4617|PayloadsAllTheThings — GraphQL Injection]]
- [[raw/book.hacktricks.wiki/graphql-hacktricks-5084|GraphQL - HackTricks]]
- [[raw/escape.tech/graphql-security-9-best-practices-to-protect-your-api-escape-4396|GraphQL Security: 9 Best Practices to Protect Your API (Escape)]]
- [[raw/github.com/inql-advanced-graphql-security-testing-burp-extension-4179|InQL: Advanced GraphQL Security Testing Burp Extension]]
- [[raw/blog.arok.win/graphql-field-suggestion-abuse-rebuilding-a-hidden-schema-15821|GraphQL field suggestion abuse: rebuilding a hidden schema]]