appsec.fyi

GraphQL — A Practical Guide

A curated AppSec resource library covering XSS, SQLi, SSRF, IDOR, RCE, XXE, OSINT, and more.

GraphQL: A Practical Guide

Curated and synthesized by . Last updated 2026-08-16. Synthesized from 103 of 103 curated resources. Browse all 103 GraphQL resources →

The GraphQL Attack Surface

GraphQL's flexibility and power as an API query language have made it a popular choice for modern applications. However, this same flexibility, combined with common implementation oversights, creates a significant and evolving attack surface. Unlike REST's endpoint-centric approach, GraphQL's single-endpoint, schema-driven model allows clients to define complex, dynamic queries at runtime [1][2]. This article will delve into the specific security challenges and exploitation techniques relevant to application security professionals.

Core Mechanics and Security Implications

At its heart, GraphQL is a query language for requesting data. A GraphQL API exposes a schema that defines the types, fields, queries, and mutations available. Clients construct queries against this schema, and resolvers on the server process these requests to fetch or manipulate data. This fundamental design, while powerful, introduces several security considerations:

Notable Attack Vectors and Exploitation Techniques

The GraphQL attack surface is multifaceted, with vulnerabilities often stemming from implementation flaws rather than inherent design weaknesses in the GraphQL specification itself [1].

Introspection Abuse and Schema Enumeration

GraphQL's introspection system allows clients to discover the API's schema, including types, fields, arguments, and relationships [14][15]. When enabled on production endpoints, this can lead to significant information disclosure, revealing the entire attack surface [1][16]. Attackers can leverage this to identify sensitive data types, administrative functions, and potential injection points. Tools like GraphQL Voyager can visualize the schema, making it easier to map relationships and identify exploitable paths [14][15][17].

If introspection is disabled, attackers may still be able to infer schema details through verbose error messages or "field suggestions" that offer corrections for mistyped queries [18][19][20]. Tools like Clairvoyance and InQL can automate this process [21][18].

Authorization and Access Control Flaws

Broken access control, including Broken Object Level Authorization (BOLA) and Insecure Direct Object References (IDOR), remains a critical vulnerability category in GraphQL, often topping the OWASP API Security Top 10 [22][23][24][25][26]. Unlike REST APIs where access control can be applied at the endpoint level, GraphQL's single endpoint requires granular authorization checks within each resolver [27][13].

Attackers can exploit missing or weak authorization checks to access data or perform actions they are not permitted to. For instance, predictable sequential IDs used in queries can be manipulated to access other users' records if backend resolvers do not properly validate the requester's identity and permissions [22][28][18]. A notable example involved an airline's booking API where sequential booking IDs allowed an unauthenticated session to access and modify passenger data [22][28]. Similarly, GitLab had a vulnerability (CVE-2021-4191) that allowed unauthenticated attackers to enumerate usernames, names, and email addresses due to a missing authentication check on GraphQL queries [29].

Denial of Service (DoS) and Resource Exhaustion

GraphQL's ability to handle complex, nested queries and batch operations makes it susceptible to DoS attacks. Attackers can craft queries that consume disproportionate server resources.

Injection Attacks

While GraphQL is strongly typed, injection vulnerabilities can still occur if user input is not properly sanitized or parameterized before being passed to backend systems like databases or operating systems [1][26][30][3].

Cross-Site Request Forgery (CSRF)

GraphQL APIs, particularly those that rely on cookies for authentication and do not enforce CSRF tokens on mutations, can be vulnerable to CSRF attacks [45][46][47][48][49]. An attacker could trick a user's browser into executing unintended mutations, potentially leading to unauthorized actions or data modifications [45][8]. The single endpoint nature of GraphQL can make it a predictable target for CSRF attacks [8][13][3].

Other Vulnerabilities

Detection and Prevention Strategies

Securing a GraphQL API requires a multi-layered approach that addresses the unique attack vectors.

Schema Management and Introspection Control

Authorization and Access Control

Query Limiting and Complexity Analysis

Preventing Other Attacks

Tooling for GraphQL Security Testing

A robust GraphQL security testing strategy involves leveraging specialized tools.

Recent Developments and Trends

The security landscape for GraphQL is dynamic. AI-powered security testing platforms are emerging, aiming to provide more application-aware testing that understands business workflows and can navigate complex authenticated journeys [63]. Supply chain attacks targeting GraphQL packages, such as the TanStack npm incident, highlight the need for supply chain security and dependency management vigilance [64]. The increasing sophistication of automated attack agents capable of discovering and exploiting GraphQL vulnerabilities autonomously underscores the need for robust, proactive security measures [22][28].

Where to Go Deeper

For a comprehensive understanding of GraphQL security, consult the following resources:

Sources cited in this guide

  1. GraphQL Security Testing: Introspection Abuse, Injection, and DoS — redteamworldwide.com
  2. GraphQL Security Testing Guide (2026) — levo.ai
  3. GraphQL Security from a Pentester's Perspective | AFINE — afine.com
  4. GraphQL | HackTricks — book.hacktricks.xyz
  5. Abusing GraphQL Introspection: A Gateway for Recon and Exploitation — infosecwriteups.com
  6. GraphQL Introspection Security: Lessons from the Parse Server Vulnerability — escape.tech
  7. Exploiting GraphQL for Penetration Testing (Raxis) — raxis.com
  8. GraphQL API Vulnerabilities - PortSwigger — portswigger.net
  9. Exploiting GraphQL Query Depth — checkmarx.com
  10. Cyclic Queries and Depth Limiting (Escape) — escape.tech
  11. Exploiting Broken Authentication Control in GraphQL — praetorian.com
  12. Authorization in GraphQL (Apollo) — apollographql.com
  13. GraphQL API Security Risks Every Developer Should Know — wiz.io
  14. PayloadsAllTheThings — GraphQL Injection — github.com
  15. OWASP WSTG: Testing GraphQL — owasp.org
  16. GraphQL introspection leads to sensitive data disclosure. — medium.com
  17. Exploiting Broken Access Control on GraphQL — vaadata.com
  18. Hacking GraphQL Endpoints in Bug Bounty Programs | YesWeHack — yeswehack.com
  19. Hacking (and Securing) GraphQL — blog.arcjet.com
  20. GraphQL Security Vulnerabilities Guide - SecPortal — secportal.io
  21. InQL: Advanced GraphQL Security Testing Burp Extension — github.com
  22. The Red Agent POV: Exploiting Broken Object-Level Authorization in an Airline GraphQL API — wiz.io
  23. What Is API Security? — paloaltonetworks.com
  24. API Threat Research: GraphQL Authorization Flaws in a FinTech Platform — salt.security
  25. GraphQL Security: How I Found and Exploited Critical IDOR and Authorization Bypass — infosecwriteups.com
  26. GraphQL API Vulnerabilities, Common Attacks & Security Tips — vaadata.com
  27. GraphQL Security: 9 Best Practices to Protect Your API (Escape) — escape.tech
  28. The Red Agent POV: Exploiting Broken Object-Level Authorization in an Airline GraphQL API — wiz.io
  29. CVE-2021-4191: GitLab GraphQL API User Enumeration (FIXED) — rapid7.com
  30. GraphQL Cheat Sheet | OWASP — cheatsheetseries.owasp.org
  31. Damn Vulnerable GraphQL Application — github.com
  32. Didn't Notice Your Rate Limiting: GraphQL Batching Attack — checkmarx.com
  33. Avoid GraphQL Denial-of-Service Attacks through Batching and Aliasing — escape.tech
  34. BatchQL: GraphQL Security Auditing for Batch Attacks — github.com
  35. Exploiting GraphQL (Assetnote Research) — assetnote.io
  36. Top GraphQL Security Vulnerabilities: Analyzing 1,500+ Endpoints — konghq.com
  37. GraphQL Attacks and Vulnerabilities — beaglesecurity.com
  38. GraphQL Security: 7 Common Vulnerabilities and Mitigations — tyk.io
  39. How GraphQL Mutation Aliasing Led to a $12,500 DoS Bug in HackerOne’s Account Recovery Flow — infosecwriteups.com
  40. DoS via Mutation Aliasing in GraphQL — HackerOne Disclosure — redpacketsecurity.com
  41. 9 Ways To Secure your GraphQL API - Apollo Checklist — apollographql.com
  42. Hasura GraphQL 1.3.3 Local File Read via SQL Injection — vulncheck.com
  43. HackerOne Report #435066: SQL injection in GraphQL endpoint — hackerone.com
  44. Prisma and PostgreSQL vulnerable to NoSQL injection? (Aikido) — aikido.dev
  45. CVE-2025-59845: CSRF Vulnerability in Apollo Studio Embeddable Explorer and Sandbox — ameeba.com
  46. Exploiting CSRF in GraphQL Applications — fdzdev.medium.com
  47. Facebook GraphQL CSRF – These aren't the access_tokens you're looking for — philippeharewood.com
  48. [TOKOPEDIA] SITE-WIDE CSRF THROUGH GRAPHQL REQUEST — rafiem.github.io
  49. [TOKOPEDIA] SITE-WIDE CSRF THROUGH GRAPHQL REQUEST — rafiem.github.io
  50. How a GraphQL Bug Resulted in Authentication Bypass — hackerone.com
  51. Apollo Router Query Planner Excessive Resource Consumption via Named Fragment Expansion (CVE-2025-32034) — github.com
  52. Apollo Authentication and Authorization Docs — apollographql.com
  53. Enforcing GraphQL security best practices with GraphOS — apollographql.com
  54. Escape-Technologies/awesome-graphql-security: A curated list of awesome GraphQL Security frameworks, libraries, software and resources — github.com
  55. https://github.com/gsmith257-cyber/GraphCrawler — github.com
  56. br3akp0int/GQLParser: A repository for GraphQL Extension for Burp Suite — github.com
  57. https://blog.assetnote.io/2021/08/29/exploiting-graphql/ — blog.assetnote.io
  58. Exploiting GraphQL — blog.assetnote.io
  59. GraphQLer: Context-Aware GraphQL API Fuzzing Tool — github.com
  60. swisskyrepo/GraphQLmap: GraphQLmap is a scripting engine to interact with a — github.com
  61. doyensec/graph-ql: GraphQL Security Research Material — github.com
  62. Teycir/BurpAPISecuritySuite: Burp Suite extension for API security testing with 15 attack types, 108+ payloads, intelligent fuzzing, BOLA/IDOR detection, AI integration, and automated reconnaissance. Supports REST/GraphQL/SOAP APIs with Nuclei, Turbo Intruder, and external tool integration. OWASP API Top 10 coverage. — github.com
  63. ZeroThreat.ai Challenges Traditional DAST With Application-Aware Security Testing — issuewire.com
  64. TanStack npm Packages Hit by Mini Shai-Hulud — snyk.io
  65. GraphQL API Vulnerabilities Learning Path — PortSwigger — portswigger.net
  66. GraphQL - Security Overview and Testing Tips · Doyensec's Blog — blog.doyensec.com
  67. doyensec/graph-ql: GraphQL Security Research Material — github.com
  68. GraphQL - HackTricks — book.hacktricks.wiki
📚 This guide is synthesized from the full text of resources curated in the GraphQL library, and refreshed as new material is added.