Mapping the schema
If introspection is enabled in production, the full schema (every query, mutation, type and argument) is one request away. That is not a vulnerability by itself, but it removes guesswork for an attacker and often reveals internal or debug operations. If introspection is disabled, field suggestions in error messages and the client's own queries can still reconstruct much of the schema.
What to test
- Resolver authorisation: a field may be protected on one parent type but reachable through another (user.orders versus order(id:)).
- Object IDs in arguments: the GraphQL form of BOLA.
- Mutations that accept input objects: mass assignment through extra input fields.
- Injection through arguments passed to SQL, NoSQL, shell or template engines.
- Query cost: deep nesting, aliases and batched operations that bypass per-request rate limits.
- Debug or diagnostic operations left in the schema.
Proving GraphQL findings
Because GraphQL usually returns 200 even on errors, status codes are poor evidence. Proof comes from the data: the response to user A's query for user B's object contains B's fields, while a query for a non-existent ID returns null or an error. For command injection, an out-of-band callback or output in the response is the evidence. Keep the full query, variables and response for each finding.
Remediation
Put authorisation in the business layer that resolvers call, not in individual resolvers, so every path to an object is checked. Disable introspection and field suggestions in production if the schema is not public. Enforce depth, complexity and alias limits, and count batched operations against rate limits. Remove diagnostic operations from production schemas.
How Pentest-Swarm tests GraphQL
Pentest-Swarm has a dedicated graphql-audit playbook and ships Damn Vulnerable GraphQL Application (DVGA) as a bundled lab for safe practice.
- Detects enabled introspection and uses the schema to plan further tests.
- Shipped DVGA chains prove systemDebug command injection and systemDiagnostics remote code execution via default credentials.
- Applies the same BOLA, injection and SSTI proofs used for REST to GraphQL arguments where the swarm can build a request recipe.
- Reports carry the query, response evidence, severity and CVSS.
Where it falls short
Pentest-Swarm does not currently test GraphQL query-cost abuse (depth, alias and batching denial of service) or batching-based rate-limit bypass automatically; tools such as graphql-cop or a manual review are better for those. Resolver-level authorisation across many nested paths also benefits from a human who understands which fields should be private.
Questions
Is GraphQL introspection a vulnerability?
On its own it is an information exposure, usually rated low. It matters because it exposes the whole attack surface, including operations never meant for clients.
How do you rate-limit GraphQL?
By query cost rather than request count: limit depth and complexity, cap aliases, and count each operation in a batch.
Can I practise GraphQL pentesting safely?
Yes. DVGA is a deliberately vulnerable GraphQL app, and Pentest-Swarm can spin it up locally, attack it and tear it down.