GraphQL Injection
Classic injection reached through GraphQL arguments, directives or transport — GraphQL types the envelope, not the content, so a
Stringargument lands in SQL, ORM operators, format strings, file paths, outbound URLs or another GraphQL document exactly as unsafely as a REST parameter would.
How it works
Resolvers are ordinary code. Scalar typing (String, ID, custom scalars) checks shape only; whatever the resolver does with the value defines the sink. Three things widen the surface relative to REST:
- Every argument, input-object field and nested filter is a parameter, and the schema enumerates them for you (GraphQL Introspection).
- Server-specific extensions (directives, filter DSLs, incremental delivery) add parsing code paths.
- Errors ride in a 200
errors[]array, often unmasked.
Sinks and cases
| Sink | Case |
|---|---|
| SQL in resolver | WPGraphQL CVE-2026-40762 (GHSA-4x56-83j8-4m8f), unauthenticated SQLi before 2.11.1; HackerOne #435066 (critical) — embedded_submission_form_uuid on /graphql (a URL parameter, not even a GraphQL argument) took stacked pg_sleep; a guest-to-admin unauthenticated SQLi writeup on another GraphQL API |
| Generated SQL engine | Hasura 1.3.3 — SQLi on the query endpoint reaching PostgreSQL pg_read_file() for local file read |
| ORM operator injection | Prisma (even on PostgreSQL): objects passed into findFirst / findMany / updateMany / deleteMany become operators — see NoSQL Injection / ORM Injection |
| Python format string | Arize Phoenix CVE-2026-53998 (CVSS 10.0, 13.0.0–<15.7.0) — applyChatTemplate rendered F_STRING templates with str.format(), which follows attribute/index lookups ({u.__class__...__globals__...}) to os.environ; unauthenticated by default; leaked PHOENIX_SECRET → forged admin JWTs and decrypted stored LLM keys |
| Directive handling | GitLab CVE-2026-19478 (CVSS 9.4, CWE-94) — unauthenticated code injection via a crafted directive (@gl_introduced in IOCs) on /api/graphql; modify/delete public projects, forge merge records; exploited in the wild within days; fixed 18.11.11 / 19.0.8 / 19.1.6 / 19.2.4 |
| Downstream GraphQL document | Chatwoot Linear integration — team_id / link_id interpolated into outbound GraphQL queries/mutations without escaping, letting quotes and syntax restructure requests to Linear’s API (GraphQL injection proper) |
| Incremental delivery merge | @graphql-tools/utils CVE-2026-114604 (10.10.1–12.0.1) — mergeIncrementalResult / setObjectKeyPath accepted non-primitive path segments, so ["__proto__"] in a @defer/@stream payload polluted Object.prototype in the client/gateway; fixed 12.0.2 |
| Filesystem | @tinacms/graphql CVE-2026-129861 (2.2.2–4.1.0) — dangling-symlink path traversal lets authenticated users write outside the content root (e.g. authorized_keys) |
| Outbound URL | URL-accepting mutations (avatar, webhook, link preview) → Server-Side Request Forgery; HTB Cereal chained a URL-fetching mutation to code execution |
| Rendered strings | Mutation-stored fields rendered by the front end → stored Cross-Site Scripting |
Testing
- Enumerate every argument and input field from the schema; fuzz all string-typed ones, not just obvious names.
- GraphQLmap: schema dump, placeholder fuzzing (
GRAPHQL_INCREMENT,GRAPHQL_CHARSET,BLIND_PLACEHOLDER) andnosqli/postgresqli/mysqlihelpers; route through Burp (InQL, GQLParser) for manual payloads; Schemathesis 4.33+ has a GraphQL coverage phase. - Also test values outside the GraphQL body: URL params on the endpoint, headers, persisted-query variables.
- Masked errors remove the signal, not the bug: in one lab, after error masking a single quote returned
Internal server error (ref ...)but a boolean always-true payload still widened results. Use boolean/time-based oracles. - Fingerprint the engine (graphw00f) and check framework CVEs — the GitLab, Phoenix and graphql-tools bugs live below application code.
Defenses
- Parameterize in resolvers; cast untrusted input to primitives before ORM calls; validate with allowlists on input types and custom scalars (OWASP).
- Never build GraphQL documents by string concatenation when calling downstream APIs — use variables.
- Sandbox template rendering; don’t expose server-side formatters to callers.
- Validate path segments and object keys on any merge of untrusted payloads.
Related
- GraphQL Security
- SQL Injection
- NoSQL Injection
- ORM Injection
- Server-Side Request Forgery
- Remote Code Execution
- API Fuzzing
Sources
- Unauthenticated SQLi in WPGraphQL 2.11.1 · original
- Unauthenticated SQL injection in WPGraphQL 2.11.1 (CVE-2026-40762) · original
- HackerOne Report #435066: SQL injection in GraphQL endpoint · original
- Unauthenticated SQLi in a GraphQL API: From Guest to Admin Takeover · original
- Hasura GraphQL 1.3.3 Local File Read via SQL Injection · original
- Prisma and PostgreSQL vulnerable to NoSQL injection? (Aikido) · original
- Arize Phoenix CVE-2026-53998: one unauthenticated GraphQL query reads os.environ via f-string · original
- Arize Phoenix: format string injection in applyChatTemplate GraphQL query leaks secrets · original
- Arize Phoenix CVE-2026-53998: GraphQL format-string secrets leak · original
- Active Exploitation Alert: Critical GitLab CVE-2026-19478 Code Injection Vulnerability · original
- Critical and High-Severity GraphQL CVEs in GitLab: Code Injection and CSRF via One Directive · original
- CVE-2026-19478: GitLab GraphQL Flaw Exploited · original
- GraphQL injection in Chatwoot's Linear integration · original
- CVE-2026-114604: GraphQL Tools prototype pollution · original
- GraphQL Tools prototype pollution advisory · original
- GraphQL Tools utils prototype pollution in incremental result merge (CVE-2026-114604) · original
- @tinacms/graphql symlink path traversal · original
- GraphQL Security Testing: Introspection Abuse, Injection, and DoS · original
- GraphQL pentesting: introspection, queries and mutations step by step · original
- swisskyrepo/GraphQLmap · original
- Confirming GraphQL DAST findings: introspection, batching, depth/cost, CSRF over GET · original
- Schemathesis 4.33.0: GraphQL coverage phase and unary gRPC fuzzing · original