India Software Labs. Speaker at Conferences and Communities like c0c0n Bsides Delhi, Null/OWASP. Null Bangalore Chapter Lead, Member of OWASP & BSides Bangalore. Certified – OSCP, eWPT,ECSA etc., }
is a query language for APIs - not databases. • GraphQL is often confused with being a database technology. • GraphQL server only exposes a single endpoint. Howtographql.com
that’s used to define the schema of an API. The syntax for writing schemas is called Schema Definition Language (SDL). Queries • Used for retrieving data/results. • Similar to GET in REST. Mutation • Used for some state changing activities. • Similar to POST/PUT/DELETE. Subscriptions • Used for Events/Realtime Updates.
Strengths GraphQL Architecture is gaining more popularity in the recent days. Some of the reasons I can think of are; • No More Over & UnderFetching. • Simple & Efficient to Use. • Evolve APIs without versioning issues. • Schema Introspection • Adapts to different requirements for different clients. • No Wonder that big Facebook, Shopify, Pinterest, HackerOne etc.,
S Weaknesses Every technology has some disadvantages, and Graphql do have few disadvantages. • Query Complexity & Depths. • Rate Limiting & Timeouts. • Caching.
T I E S Opportunity for Hackers • There is a wide scope for the pentesters & bug bounty hunters on GraphQL. • The GraphQL Endpoints like /graphql or /graphiql are still publicly available out there due missing security best practices.
E A T S T O A V O I D Threats!!! There are many approaches to secure your GraphQL server against these queries, but none of them is bullet proof. It’s important to know what options are available and know their limits and take best decisions out of it!. • Disable well known /graphql & /graphiql endpoints from the domain. • Craft your own schema and avoid using autogenerated SDL which creates queries and mutations. • Input validation, Authentication & Authorization should never be forgotten. • Never trust user inputs. • Enforce a limit on maximum query depth(~<10), Query complexity, timeouts & enabled throttling based on the server time & query complexity.