Skip to content
Craft: GraphQL SQL injection and prerequisites

Craft: GraphQL SQL injection and prerequisites

github.com • November 9, 2026

An anonymous GraphQL request can inject arbitrary SQL expressions into an element query’s SELECT clause. Arguments hung off an eager-loadable node that is absent from the active public schema are copied into EagerLoadPlan::$criteria and written onto the eager-loaded query with Craft::configure() , without passing through any of Craft’s criteria cleansing. A select value containing a parenthesis is emitted into the SQL verbatim by Yii’s query builder, so it is evaluated by the database.

This reaches the same criteria path as GHSA-9c4j-cjw3-r3xx , but it is not that issue and is not fixed by it. That advisory’s fix types EagerLoadPlan::$when as ?Closure , which closes the callable sink. The select injection does not involve $when at all: it needs no nested with , no callback, and no system() .

The public GraphQL schema is enabled and grants anonymous read access to at least one section or one asset volume, but not to user groups.

At least one entry with an author, or one asset with a populated uploaderId .

The schema shape is the ordinary least-privilege configuration for a headless frontend that publishes content without publishing user records. It is materially more common than the asset-volume-only configuration required by the earlier eager-load report: an entries-only public schema is the default shape of a Craft headless install.

Granting the schema user-group read access removes the exposure, because uploader / author are then published as real fields with fixed argument definitions, and the injected select argument is rejected as unknown.

The GHSA-9c4j-cjw3-r3xx fix in 5.10.13 types EagerLoadPlan::$when as ?Closure . That prevents a string from being stored on the callable property, which closes both routes into that sink.

It does not affect this issue. The injection here is in $plan->criteria , applied by Craft::configure() before any callback is considered, and the exploit sends no with argument at all.

An unauthenticated attacker can read arbitrary data from the Craft database, including user email addresses and password hashes, session and verification tokens, and any content stored in the database, regardless of GraphQL schema scope. The schema restrictions the operator configured provide no protection, because the injected SQL runs beneath the schema layer.

Extracted Entities

Attack Types (1)

CWE Weaknesses (1)

Platforms (2)