logo

CVE-2025-31481 api-platform/graphql

Package

Manager: composer
Name: api-platform/graphql
Vulnerable Version: >=4.0.0-alpha.1 <4.0.22 || >=0 <3.4.17 || >=4.1.0-alpha.1 <4.1.5

Severity

Level: High

CVSS v3.1: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

CVSS v4.0: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N

EPSS: 0.00039 pctl0.10466

Details

GraphQL query operations security can be bypassed ### Summary Using the Relay special `node` type you can bypass the configured security on an operation. ### Details Here is an example of how to apply security configurations for the GraphQL operations: ```php #[ApiResource( security: "is_granted('ROLE_USER')", operations: [ /* ... */ ], graphQlOperations: [ new Query(security: "is_granted('ROLE_USER')"), //... ], )] class Book { /* ... */ } ``` This indeed checks `is_granted('ROLE_USER')` as expected for a GraphQL query like the following: ```php ‌query { book(id: "/books/1") { title } } ``` But the security check can be bypassed by using the `node` field (that is available by default) on the root query type like that: ```php ‌query { node(id: "/books/1") { ... on Book { title } } } ``` This does not execute any security checks and can therefore be used to access any entity without restrictions by everyone that has access to the API. ### Impact Everyone using GraphQl with the `security` attribute. Not sure whereas this works with custom resolvers nor if this also applies on mutation. Patched at https://github.com/api-platform/core/commit/60747cc8c2fb855798c923b5537888f8d0969568

Metadata

Created: 2025-04-04T14:07:20Z
Modified: 2025-08-29T21:07:09Z
Source: https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/04/GHSA-cg3c-245w-728m/GHSA-cg3c-245w-728m.json
CWE IDs: ["CWE-863"]
Alternative ID: GHSA-cg3c-245w-728m
Finding: F006
Auto approve: 1