GraphQL
Definition
GraphQL is a query language for APIs and a runtime for executing those queries, enabling clients to request exactly the data they need and nothing more, often used to improve performance and flexibility over traditional REST APIs.
query
: Read datamutation
: Write or delete data
GraphQL Batching
GraphQL batching allows clients to combine multiple GraphQL queries into a single request. Instead of making several individual requests, clients can bundle multiple queries together and send them to the server in one HTTP POST request. The server then processes these queries together and returns a batched response with the requested data.
This can be used to bypass HTTP rate limiting. Example with the write up of the challenge: corCTF 2023 - web/force
:
GraphQL Batching - Example PoC
Inputs/Outputs scope
Injecting extra parameters can result in unauthorized activities, such as:
- In queries, it can lead to accessing additional information, like obtaining password hashes or password reset tokens.
- In mutations, it might involve altering parameters, like setting an
isAdmin
field totrue
.
Tools
- GraphQL Voyager: Represent any GraphQL API as an interactive graph.