GraphQL is an API query language that is designed to facilitate efficient communication between clients and servers. It enables the user to specify exactly what data they want in the response, helping to avoid the large response objects and multiple calls that can sometimes be seen with REST APIs.
GraphQL services are commonly used in authentication and data retrieval mechanisms. This means that if an attacker can successfully send malicious requests, they may be able to access vulnerable information or even execute higher-severity exploits such as cross-site request forgery (CSRF).
Burp Suite's InQL extension makes it easy to construct GraphQL requests and learn more about an API's schema.
For a full primer on what GraphQL is and how it works, see Web Security Academy: What is GraphQL?.
To set up InQL with Burp Suite:
If InQL detects a GraphQL request, it automatically adds an InQL tab to the message editor for that request. The InQL tab provides an efficient way to modify GraphQL queries and their variable dictionaries. Once InQL is installed, the tab appears for any request that has a valid JSON object as its body.
The InQL tab enables you to view queries and variable dictionaries independently of the rest of a request. The query structure is displayed as a JSON object in the Query panel, and its associated variables in the Variables panel underneath.
In editable contexts (such as when viewing a request in Repeater) you can edit GraphQL queries directly in the InQL tab.
InQL can send GraphQL requests to Repeater using different request methods and body encodings. This is useful in circumstances where you need to send requests in a different format to "standard" JSON POST (for example, if introspection is disabled on the POST method but not on the GET method).
To convert request formats in InQL, right-click on an unconverted GraphQL request and select Extensions > InQL - Introspection GraphQL Scanner > [select option]. The following options are available:
Content-Type of application/x-www-form-urlencoded. The request body is converted to URL encoding.
Content-Type of multipart/form-data. The request body is converted to form data.
If you select one of these options from within Repeater, Burp opens a new Repeater tab with the request in the specified format.
Note that you cannot use InQL to convert a request that has already been converted.
InQL Scanner enables you to gain information about a GraphQL endpoint's schema. It uses GraphQL's built-in introspection feature to list all queries and mutations supported by the API. This information is extremely useful when planning how to attack an API.
To run a scan with InQL:
Enter the location of the schema into the address bar. You can do this in two ways:
/tmp/schema.json) or click Load and browse to the file.
To view queries or mutations once you have run an InQL scan:
In the example above, the scan has found one available query: a getUser query that takes a user ID and returns the associated ID and username.