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-09-01. Synthesized from 116 of 116 curated resources. Browse all 116 GraphQL resources →

The Problem: Unauthenticated Impact on Public Projects

GraphQL, while offering a flexible and efficient way to interact with APIs, presents a unique attack surface. One significant vulnerability category involves the ability of unauthenticated attackers to manipulate or delete data within public projects. This capability, often stemming from improper input validation or authorization bypasses within GraphQL endpoints, can lead to data integrity loss and service disruption. A notable example is CVE-2026-19478, a critical vulnerability impacting GitLab instances. This flaw allows unauthenticated attackers to modify or delete public projects and associated user data through a maliciously crafted GraphQL directive [1][2][3][4][5][6][7][8][9][10][11][12][13]. The implications extend beyond simple data modification, potentially enabling attackers to forge merge records, ban legitimate maintainers, or even delete entire repositories, thereby compromising the integrity of software supply chains [2][6][7].

Core Mechanics: How GraphQL APIs are Exploited

GraphQL's power lies in its flexibility and its single-endpoint architecture, which can also be its undoing. Unlike REST APIs with multiple endpoints, a single GraphQL endpoint typically handles all queries and mutations. This centralization, combined with the client's ability to define complex, nested queries, opens up several avenues for exploitation.

At a foundational level, many GraphQL vulnerabilities stem from insufficient validation and authorization checks within the resolvers that process incoming queries [14][15]. For instance, the CVE-2026-19478 vulnerability in GitLab was rooted in how the @gl_introduced directive was handled. Attackers could leverage this by injecting specially crafted field names, bypassing authentication and authorization controls to manipulate project metadata and repository contents [1][8]. The GraphQL specification's provision for introspection, which allows clients to query the schema structure, is another critical area. When introspection is left enabled in production, it can reveal the entire API surface, providing attackers with a roadmap for targeted attacks, including identifying sensitive data types, undocumented fields, or administrative functions [16][17][18][19][20][21][22].

Another common vulnerability is Broken Object Level Authorization (BOLA), where an application fails to validate if a user has permission to access a specific object or record [23][24][25][26]. In GraphQL, this often manifests when predictable identifiers, such as sequential IDs, are used without robust backend validation, allowing attackers to manipulate these identifiers to access unauthorized data [23][24][27][15]. Furthermore, the very flexibility of GraphQL, allowing complex and deeply nested queries, can be exploited for Denial-of-Service (DoS) attacks. Attackers can craft queries that force disproportionate computation, overwhelming the server's resources [28][29][30][18][20]. This is exacerbated by features like query batching and aliasing, which allow multiple operations or expensive queries to be bundled into a single request, potentially bypassing rate limits and exhausting server resources [31][32][33][34][35][36][37][18].

Finally, standard web vulnerabilities like SQL injection, command injection, and Cross-Site Scripting (XSS) can also be present in GraphQL APIs if inputs are not properly sanitized or parameterized before being passed to backend systems [38][39][40][41][42].

Notable GraphQL Exploitation Techniques

The flexibility of GraphQL, while beneficial for developers, creates numerous attack vectors that security professionals must understand.

Introspection Abuse and Schema Enumeration

GraphQL's introspection feature allows clients to query the schema, revealing types, fields, queries, and mutations. When enabled in production, this provides attackers with a comprehensive understanding of the API's structure and potential vulnerabilities, facilitating targeted attacks. Tools like GraphQLmap [43] and InQL [44][45][46] can automate this process. Even if introspection is disabled, field suggestions in error messages can sometimes be leveraged to infer schema details [17][18][19][20][47][48].

Injection Attacks (SQL, NoSQL, Command, SSRF)

Like any API, GraphQL endpoints are susceptible to injection attacks if user-supplied input is not properly validated or parameterized before being passed to backend systems [14][39][40][41][42][49]. This includes SQL injection in database queries, command injection when executing system commands, and Server-Side Request Forgery (SSRF) when fields accept URLs, potentially allowing access to internal resources or cloud metadata [50][41][20]. For example, injecting SQL payloads into arguments can lead to unauthorized data access or modification [51][38][52][53].

Broken Object Level Authorization (BOLA) and Insecure Direct Object Reference (IDOR)

A common GraphQL vulnerability involves insufficient authorization checks at the object level. This allows attackers to manipulate identifiers in API requests to access or modify data belonging to other users or objects they are not authorized to access [23][24][54][27][25][55][26][15][56]. For example, an attacker might change a user ID parameter in a query to retrieve another user's data.

Denial of Service (DoS) via Query Complexity

GraphQL's ability to craft complex, deeply nested queries can be exploited for DoS attacks. Attackers can send queries that force excessive computation, resource exhaustion, or infinite loops, leading to service degradation or complete unavailability [28][29][57][58][30][18][20][56]. This is particularly problematic when combined with features like query batching and aliasing.

Batching Attacks and Alias Overloading

GraphQL supports query batching, allowing multiple queries in a single HTTP request. This can bypass rate limiting and enable attackers to perform numerous operations (like brute-forcing credentials or OTPs) in one go [31][32][33][34][35][36][37][18][48]. Similarly, alias overloading allows attackers to disguise repeated costly operations under different field aliases, further amplifying DoS risks [32][18][20].

Cross-Site Request Forgery (CSRF)

When GraphQL APIs rely on cookies for authentication and lack proper CSRF protection, attackers can trick users' browsers into executing unauthorized mutations or queries [59][60][61][62][35][53][18]. This is particularly concerning for mutations that alter data.

CVE-2026-19478: A Specific Example of Impact

The GitLab vulnerability CVE-2026-19478 serves as a potent illustration of how GraphQL flaws can lead to significant impact. This critical flaw allowed unauthenticated attackers to modify or delete public projects and user data via a GraphQL directive, such as @gl_introduced [1][2][3][4][5][6][7][12]. The exploitation chain involved injecting a specially crafted GraphQL directive that bypassed authentication and authorization controls, enabling remote modification of project metadata and repository contents [1]. Successful exploitation could result in project deletion, repository removal, the forging of merge records, or the banning of project maintainers [2][6][7]. The rapid exploitation of this vulnerability shortly after its disclosure underscored the urgency of patching such critical flaws [1][2][6].

Detection and Prevention Strategies

Mitigating GraphQL-specific vulnerabilities requires a multi-layered approach, focusing on secure configuration, robust validation, and diligent monitoring.

Secure Configuration and Input Validation

Disabling GraphQL introspection in production environments unless absolutely necessary is a crucial first step to reduce the attack surface [39][16][18][20][21][22]. Furthermore, all user inputs, whether in query arguments or mutation payloads, must undergo rigorous validation and sanitization. This includes using specific GraphQL scalar types, custom validators, and defining schemas for mutation inputs. Employing allow-lists for characters and ensuring proper encoding for Unicode characters can prevent various injection attacks [42]. For inputs intended for other interpreters (like databases or operating systems), using parameterized statements or prepared statements is paramount [63][41][42].

Access Control and Authorization

GraphQL does not natively enforce access controls; this responsibility falls to developers. Implementing robust authentication and authorization mechanisms at the resolver level is critical. This involves verifying user identity and permissions for each query and mutation. For sensitive operations, fine-grained, role-based access control (RBAC) should be implemented, ensuring that only authorized users can access specific data or perform certain actions [64][65][25][18][26][15]. Putting authenticated user information into the GraphQL context is a common pattern for this [64][65][66].

Query Limiting and Resource Management

To prevent DoS attacks stemming from complex queries, implementing query depth and complexity limits is essential. These limits prevent overly nested or resource-intensive queries from being executed [29][58][30][18][42][20]. Timeouts for query execution and rate limiting on API requests (per IP, user, or a combination) are also vital to manage server load and prevent abuse [31][32][33][58][18][42]. Query batching should be carefully managed or disabled if not strictly necessary, and its implementation should be monitored for abuse [37][18][42].

Monitoring and Logging

Continuous monitoring of GraphQL API traffic is crucial for detecting anomalous activity. This includes looking for excessive error messages, unusual query patterns, or attempts to bypass security controls. Comprehensive logging of all GraphQL requests, especially those that trigger errors or security alerts, is essential for incident response and forensic analysis [1][3][4][5].

Specific Mitigations for Known Vulnerabilities

For vulnerabilities like CVE-2026-19478, immediate patching of affected systems is the primary mitigation. If patching is delayed, restricting unauthenticated access to the GraphQL endpoint and monitoring logs for specific indicators like the @gl_introduced directive can provide temporary relief [1][2][4][6]. For CSRF vulnerabilities, ensuring GraphQL requests use POST with a Content-Type: application/json header and implementing CSRF tokens can significantly reduce risk [53][67][68][59][61].

Tooling for GraphQL Security Assessment

A variety of tools can assist security professionals in identifying and exploiting GraphQL vulnerabilities.

Reconnaissance and Schema Discovery

Burp Suite Extensions

Fuzzing and Exploitation Tools

Manual Testing Tools

Recent Developments and Trends

The landscape of GraphQL security is continually evolving, with new attack vectors and defensive techniques emerging. Recent trends highlight the increasing sophistication of automated attacks, often powered by AI, which can compress the time between vulnerability disclosure and exploitation [1][2]. The widespread adoption of GraphQL across various industries means that vulnerabilities, if left unaddressed, can have significant downstream impacts on software supply chains and organizational trust [2][7]. The focus is increasingly shifting towards runtime security analysis and continuous testing, as static analysis alone cannot account for the dynamic nature of GraphQL queries and schema evolution [15]. Furthermore, the integration of GraphQL into complex microservice architectures necessitates a robust understanding of inter-service communication security and access control enforcement at the edge of the API gateway [79].

Where to Go Deeper

For those seeking to deepen their understanding of GraphQL security, several resources offer comprehensive insights:

Sources cited in this guide

  1. Active Exploitation Alert: Critical GitLab CVE-2026-19478 Code Injection Vulnerability Targets Unpatched Instances — rescana.com
  2. Critical GitLab vulnerability exploited days after disclosure — fieldeffect.com
  3. CVE-2026-19478: GitLab GraphQL Flaw Exploited — socradar.io
  4. GitLab Warns of Active Exploitation of Critical GraphQL Flaw — securityaffairs.com
  5. GitLab Warns of Active Exploitation of Critical GraphQL Flaw — securityaffairs.com
  6. GitLab CVE-2026-19478 Comes Under Active Exploitation Within Days of Disclosure — thehackernews.com
  7. GitLab Patches Critical CVE-2026-19478 GraphQL Vulnerability — esecurityplanet.com
  8. Critical and High-Severity GraphQL CVEs in GitLab: Code Injection and CSRF via One Directive — ox.security
  9. Critical GitLab flaw allows attackers to modify or delete public projects (CVE-2026-19478) — helpnetsecurity.com
  10. GitLab Patches Critical Code Injection Vulnerability — securityweek.com
  11. GitLab Patches Critical Unauthenticated GraphQL Vulnerability — securityaffairs.com
  12. CVE-2026-19478: Critical GitLab CE/EE GraphQL Vulnerability Enables Remote Deletion of Public Projects and User Data — rescana.com
  13. Critical GitLab GraphQL Flaw Could Let Unauthenticated Attackers Delete Public Projects — thehackernews.com
  14. What Is API Security? — paloaltonetworks.com
  15. GraphQL Security Testing Guide (2026) — levo.ai
  16. OWASP WSTG: Testing GraphQL — owasp.org
  17. GraphQL Security Testing: Introspection Abuse, Injection, and DoS — redteamworldwide.com
  18. GraphQL Security: 7 Common Vulnerabilities and Mitigations — tyk.io
  19. Hacking GraphQL Endpoints in Bug Bounty Programs | YesWeHack — yeswehack.com
  20. GraphQL Security from a Pentester's Perspective | AFINE — afine.com
  21. GraphQL introspection leads to sensitive data disclosure. — medium.com
  22. GraphQL Introspection leads to Sensitive Data Disclosure. — medium.com
  23. The Red Agent POV: Exploiting Broken Object-Level Authorization in an Airline GraphQL API — wiz.io
  24. The Red Agent POV: Exploiting Broken Object-Level Authorization in an Airline GraphQL API — wiz.io
  25. GraphQL API Security Risks Every Developer Should Know — wiz.io
  26. GraphQL Security: How I Found and Exploited Critical IDOR and Authorization Bypass — infosecwriteups.com
  27. Exploiting GraphQL Vulnerabilities: Misconfig to Data Leaks — dev.to
  28. CVE-2025-31496: GraphQL Query Vulnerability in Apollo Compiler Leading to DoS — ameeba.com
  29. Exploiting GraphQL Query Depth — checkmarx.com
  30. Cyclic Queries and Depth Limiting (Escape) — escape.tech
  31. Didn't Notice Your Rate Limiting: GraphQL Batching Attack — checkmarx.com
  32. Avoid GraphQL Denial-of-Service Attacks through Batching and Aliasing — escape.tech
  33. DoS via Mutation Aliasing in GraphQL — HackerOne Disclosure — redpacketsecurity.com
  34. BatchQL: GraphQL Security Auditing for Batch Attacks — github.com
  35. Exploiting GraphQL (Assetnote Research) — assetnote.io
  36. GraphQL Attacks and Vulnerabilities — beaglesecurity.com
  37. GraphQL API Vulnerabilities and Common Attacks — imperva.com
  38. Discovering GraphQL endpoints and SQLi vulnerabilities — medium.com
  39. GraphQL Security: 9 Best Practices to Protect Your API (Escape) — escape.tech
  40. Hacking (and Securing) GraphQL — blog.arcjet.com
  41. GraphQL Security Flaws and Exploitation — infosecwriteups.com
  42. GraphQL Cheat Sheet | OWASP — cheatsheetseries.owasp.org
  43. swisskyrepo/GraphQLmap: GraphQLmap is a scripting engine to interact with a — github.com
  44. InQL: Advanced GraphQL Security Testing Burp Extension — github.com
  45. doyensec/graph-ql: GraphQL Security Research Material — github.com
  46. doyensec/graph-ql: GraphQL Security Research Material — github.com
  47. Escape-Technologies/awesome-graphql-security: A curated list of awesome GraphQL Security frameworks, libraries, software and resources — github.com
  48. https://blog.assetnote.io/2021/08/29/exploiting-graphql/ — blog.assetnote.io
  49. Mastering the Realm of GraphQL Exploitation — infosecwriteups.com
  50. 👩‍💻Roadmap to Cybersecurity in 2022, Full-Read SSRF, IDOR in GraphQL, GCP Pentesting, and much… — infosecwriteups.com
  51. Hasura GraphQL 1.3.3 Local File Read via SQL Injection — vulncheck.com
  52. HackerOne Report #435066: SQL injection in GraphQL endpoint — hackerone.com
  53. GraphQL API Vulnerabilities - PortSwigger — portswigger.net
  54. GraphQL IDOR leads to information disclosure (Eshan Singh) — medium.com
  55. Exploiting Broken Access Control on GraphQL — vaadata.com
  56. GraphQL - Security Overview and Testing Tips · Doyensec's Blog — blog.doyensec.com
  57. Apollo Router Query Planner Excessive Resource Consumption via Named Fragment Expansion (CVE-2025-32034) — github.com
  58. Securing GraphQL API endpoints using rate limits and depth limits (LogRocket) — blog.logrocket.com
  59. [TOKOPEDIA] SITE-WIDE CSRF THROUGH GRAPHQL REQUEST — rafiem.github.io
  60. Facebook GraphQL CSRF – These aren't the access_tokens you're looking for — philippeharewood.com
  61. [TOKOPEDIA] SITE-WIDE CSRF THROUGH GRAPHQL REQUEST — rafiem.github.io
  62. Exploiting CSRF in GraphQL Applications — fdzdev.medium.com
  63. Prisma and PostgreSQL vulnerable to NoSQL injection? (Aikido) — aikido.dev
  64. Authorization in GraphQL (Apollo) — apollographql.com
  65. 9 Ways To Secure your GraphQL API - Apollo Checklist — apollographql.com
  66. Apollo Authentication and Authorization Docs — apollographql.com
  67. GraphQL | HackTricks — book.hacktricks.xyz
  68. Facebook GraphQL CSRF – These aren't the access_tokens you're looking for — philippeharewood.com
  69. PayloadsAllTheThings - GraphQL Injection — github.com
  70. GraphQL - HackTricks — book.hacktricks.wiki
  71. Approaching GraphQL End Points — Bug Bounty Notes — 0xayub.gitbook.io
  72. https://github.com/gsmith257-cyber/GraphCrawler — github.com
  73. 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
  74. br3akp0int/GQLParser: A repository for GraphQL Extension for Burp Suite — github.com
  75. Damn Vulnerable GraphQL Application — github.com
  76. GraphQLer: Context-Aware GraphQL API Fuzzing Tool — github.com
  77. PayloadsAllTheThings — GraphQL Injection — github.com
  78. Exploiting GraphQL — blog.assetnote.io
  79. Enforcing GraphQL security best practices with GraphOS — apollographql.com
  80. GraphQL API Vulnerabilities Learning Path — PortSwigger — portswigger.net
📚 This guide is synthesized from the full text of resources curated in the GraphQL library, and refreshed as new material is added.