# 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
| 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`) 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.
## Related
- [[GraphQL Security]]
- [[SQL Injection]]
- [[NoSQL Injection]]
- [[ORM Injection]]
- [[Server-Side Request Forgery]]
- [[Remote Code Execution]]
- [[API Fuzzing]]
## Sources
- [[raw/github.com/unauthenticated-sqli-in-wpgraphql-2-11-1-13201|Unauthenticated SQLi in WPGraphQL 2.11.1]]
- [[raw/github.com/unauthenticated-sql-injection-in-wpgraphql-2-11-1-cve-2026-40762-12763|Unauthenticated SQL injection in WPGraphQL 2.11.1 (CVE-2026-40762)]]
- [[raw/hackerone.com/hackerone-report-435066-sql-injection-in-graphql-endpoint-4394|HackerOne Report #435066: SQL injection in GraphQL endpoint]]
- [[raw/medium.com/unauthenticated-sqli-in-a-graphql-api-from-guest-to-admin-takeover-12453|Unauthenticated SQLi in a GraphQL API: From Guest to Admin Takeover]]
- [[raw/vulncheck.com/hasura-graphql-1-3-3-local-file-read-via-sql-injection-4392|Hasura GraphQL 1.3.3 Local File Read via SQL Injection]]
- [[raw/aikido.dev/prisma-and-postgresql-vulnerable-to-nosql-injection-aikido-4395|Prisma and PostgreSQL vulnerable to NoSQL injection? (Aikido)]]
- [[raw/corgea.com/arize-phoenix-cve-2026-53998-one-unauthenticated-graphql-query-reads-o-15484|Arize Phoenix CVE-2026-53998: one unauthenticated GraphQL query reads os.environ via f-string]]
- [[raw/github.com/arize-phoenix-format-string-injection-in-applychattemplate-graphql-que-14497|Arize Phoenix: format string injection in applyChatTemplate GraphQL query leaks secrets]]
- [[raw/stackurity.ai/arize-phoenix-cve-2026-53998-graphql-format-string-secrets-leak-15629|Arize Phoenix CVE-2026-53998: GraphQL format-string secrets leak]]
- [[raw/rescana.com/active-exploitation-alert-critical-gitlab-cve-2026-19478-code-injectio-11745|Active Exploitation Alert: Critical GitLab CVE-2026-19478 Code Injection Vulnerability]]
- [[raw/ox.security/critical-and-high-severity-graphql-cves-in-gitlab-code-injection-and-c-11524|Critical and High-Severity GraphQL CVEs in GitLab: Code Injection and CSRF via One Directive]]
- [[raw/socradar.io/cve-2026-19478-gitlab-graphql-flaw-exploited-11667|CVE-2026-19478: GitLab GraphQL Flaw Exploited]]
- [[raw/static.rdintel.com/graphql-injection-in-chatwoot-s-linear-integration-14205|GraphQL injection in Chatwoot's Linear integration]]
- [[raw/miggo.io/cve-2026-114604-graphql-tools-prototype-pollution-15486|CVE-2026-114604: GraphQL Tools prototype pollution]]
- [[raw/advisories.gitlab.com/graphql-tools-prototype-pollution-advisory-13387|GraphQL Tools prototype pollution advisory]]
- [[raw/secopssignal.com/graphql-tools-utils-prototype-pollution-in-incremental-result-merge-cv-14353|GraphQL Tools utils prototype pollution in incremental result merge (CVE-2026-114604)]]
- [[raw/github.com/tinacms-graphql-symlink-path-traversal-14898|@tinacms/graphql symlink path traversal]]
- [[raw/redteamworldwide.com/graphql-security-testing-introspection-abuse-injection-and-dos-3120|GraphQL Security Testing: Introspection Abuse, Injection, and DoS]]
- [[raw/pwnatlas.app/graphql-pentesting-introspection-queries-and-mutations-step-by-step-15483|GraphQL pentesting: introspection, queries and mutations step by step]]
- [[raw/github.com/swisskyrepo-graphqlmap-graphqlmap-is-a-scripting-engine-to-interact-wi-430|swisskyrepo/GraphQLmap]]
- [[raw/dedsecops.com/confirming-graphql-dast-findings-introspection-batching-depth-cost-csr-14495|Confirming GraphQL DAST findings: introspection, batching, depth/cost, CSRF over GET]]
- [[raw/github.com/schemathesis-4-33-0-graphql-coverage-phase-and-unary-grpc-fuzzing-14494|Schemathesis 4.33.0: GraphQL coverage phase and unary gRPC fuzzing]]