hackweb
notes on hacking and technology
IT EN
main menu
user menu
you are not logged in

GraphQL abuse: introspection, batching, depth

November 27, 2024 · 1 min read · #web #graphql #api

GraphQL lets the client compose queries. Useful, but it shifts risk: the whole schema can be discovered, and authorization checks must cover every field, not just the endpoint.

The problems

Introspection: __schema reveals all types and operations, mapping the surface. Nested queries: cyclic relations generate huge queries (DoS). Batching: many operations in one request bypass rate limits (e.g. login brute-force). Per-field BOLA: a field returns others' data if the check is missing.

{ __schema { types { name fields { name } } } }   # schema dump

Defence

Disable introspection in production, limit query depth and complexity (depth/cost analysis), rate-limit counting operations not requests, and authorization at the resolver/field level. Persisted queries to accept only known operations.


« back to home

latest posts
 
your IP address:
216.73.216.108
visitor #0
MOTD:
Every abstraction leaks somewhere.
Here we look at where.
topics