GraphQL Injection

Classic injection reached through GraphQL arguments, directives or transport — GraphQL types the envelope, not the content, so a String argument 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

SinkCase
SQL in resolverWPGraphQL 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 engineHasura 1.3.3 — SQLi on the query endpoint reaching PostgreSQL pg_read_file() for local file read
ORM operator injectionPrisma (even on PostgreSQL): objects passed into findFirst / findMany / updateMany / deleteMany become operators — see NoSQL Injection / ORM Injection
Python format stringArize 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 handlingGitLab 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 documentChatwoot 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 URLURL-accepting mutations (avatar, webhook, link preview) → Server-Side Request Forgery; HTB Cereal chained a URL-fetching mutation to code execution
Rendered stringsMutation-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) and nosqli / postgresqli / mysqli helpers; 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.

Sources