GraphQL Injection
GraphQL is a query language for APIs and a runtime for fulfilling those queries with existing data. A GraphQL service is created by defining types and fields on those types, then providing functions for each field on each type
Summary
Tools
swisskyrepo/GraphQLmap - Scripting engine to interact with a graphql endpoint for pentesting purposes
doyensec/inql - A Burp Extension for GraphQL Security Testing
doyensec/GQLSpection - GQLSpection - parses GraphQL introspection schema and generates possible queries
R0B1NL1N/graphql-craft - GraphQL security testing tool with advanced payload generation
doyensec/Altair - GraphQL client for testing and debugging
dee-see/graphql-path-enum - Lists the different ways of reaching a given type in a GraphQL schema
andev-software/graphql-ide - An extensive IDE for exploring GraphQL API's
mchoji/clairvoyancex - Obtain GraphQL API schema despite disabled introspection
nicholasaleks/CrackQL - A GraphQL password brute-force and fuzzing utility
nicholasaleks/graphql-threat-matrix - GraphQL threat framework used by security professionals to research security gaps in GraphQL implementations
dolevf/graphql-cop - Security Auditor Utility for GraphQL APIs
IvanGoncharov/graphql-voyager - Represent any GraphQL API as an interactive graph
Insomnia - Cross-platform HTTP and GraphQL Client
Escape-Technologies/graphql-introspection - Advanced GraphQL introspection tool
davideuler/architect - GraphQL security testing and analysis framework
Postman - GraphQL client with built-in testing capabilities
zbynekml/GraphQL-Parser - GraphQL query parser and validator
dtrinh90/GraphQL-Fuzzer - GraphQL API fuzzer
DontPanicO/Artemis - Automated GraphQL security testing
GraphQL playground - Interactive GraphQL IDE
Enumeration
Common GraphQL Endpoints
Most of the time GraphQL is located at the /graphql or /graphiql endpoint. A more complete list is available at danielmiessler/SecLists/graphql.txt.
Identify An Injection Point
Check if errors are visible.
Enumerate Database Schema via Introspection
URL encoded query to dump the database schema.
URL decoded query to dump the database schema.
Single line queries to dump the database schema without fragments.
Enumerate Database Schema via Suggestions
When you use an unknown keyword, the GraphQL backend will respond with a suggestion related to its schema.
You can also try to bruteforce known keywords, field and type names using wordlists such as Escape-Technologies/graphql-wordlist when the schema of a GraphQL API is not accessible.
Enumerate Types Definition
Enumerate the definition of interesting types using the following GraphQL query, replacing "User" with the chosen type
List Path To Reach A Type
Methodology
Extract Data

Extract Data Using Edges/Nodes
Extract Data Using Projections
⚠️ Don’t forget to escape the " inside the options.
Mutations
Mutations work like function, you can use them to interact with the GraphQL.
GraphQL Batching Attacks
Common scenario:
Password Brute-force Amplification Scenario
Rate Limit bypass
2FA bypassing
JSON List Based Batching
Query batching is a feature of GraphQL that allows multiple queries to be sent to the server in a single HTTP request. Instead of sending each query in a separate request, the client can send an array of queries in a single POST request to the GraphQL server. This reduces the number of HTTP requests and can improve the performance of the application.
Query batching works by defining an array of operations in the request body. Each operation can have its own query, variables, and operation name. The server processes each operation in the array and returns an array of responses, one for each query in the batch.
Query Name Based Batching
Send the same mutation several times using aliases
Injections
SQL and NoSQL Injections are still possible since GraphQL is just a layer between the client and the database.
NOSQL Injection
Use $regex inside a search parameter.
SQL Injection
Send a single quote ' inside a GraphQL parameter to trigger the SQL injection
Simple SQL injection inside a GraphQL field.
Labs
References
Last updated