CVE-2025-31481: Api platform/graphql GraphQL Query Operations Security Can Vulnerability
HIGHCVE-2025-31481 is a HIGH (CVSS 7.5) graphql query operations security can vulnerability (CWE-863: Incorrect Authorization) affecting Api platform/graphql libraries in the Packagist ecosystem. The issue involves graphql query operations security can be bypassed. Remediation is available by upgrading affected packages to version 4.0.22, 3.4.17, 4.1.5.
CVE-2025-31481 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2025-31481
To remediate this vulnerability, upgrade all affected Api platform/graphql dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade api-platform/graphql to 4.0.22
Upgrade api-platform/core to 4.0.22
Upgrade api-platform/graphql to 3.4.17
Upgrade api-platform/core to 3.4.17
Upgrade api-platform/graphql to 4.1.5
Upgrade api-platform/core to 4.1.5
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for api-platform/graphql
How to Check if You Are Affected
To determine whether your application is affected by CVE-2025-31481, inspect your project dependencies for Api platform/graphql:
inspect dependencies for api-platform/graphql
Analyze the terminal output to locate any version of Api platform/graphql in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.0.22), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-863: Incorrect Authorization, where the product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. In Api platform/graphql, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-31481 Affected Api platform/graphql Versions
6 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
api-platform/graphql
|
Packagist |
≥ 4.0.0-alpha.1
< 4.0.22
|
4.0.22
|
|
api-platform/core
|
Packagist |
≥ 4.0.0-alpha.1
< 4.0.22
|
4.0.22
|
|
api-platform/graphql
|
Packagist |
< 3.4.17
|
3.4.17
|
|
api-platform/core
|
Packagist |
< 3.4.17
|
3.4.17
|
|
api-platform/graphql
|
Packagist |
≥ 4.1.0-alpha.1
< 4.1.5
|
4.1.5
|
|
api-platform/core
|
Packagist |
≥ 4.1.0-alpha.1
< 4.1.5
|
4.1.5
|
References
Frequently Asked Questions
What is CVE-2025-31481?
Which Api platform/graphql versions are affected?
What version fixes CVE-2025-31481?
Is api-platform/graphql affected?
Is api-platform/core affected?
What is the CVSS score of CVE-2025-31481?
What CWE is associated with CVE-2025-31481?
How can I check Packagist dependencies for CVE-2025-31481?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-cg3c-245w-728m",
"modified" : "2025-08-29T21:07:09Z",
"published" : "2025-04-04T14:07:20Z",
"aliases" : [ "CVE-2025-31481" ],
"summary" : "GraphQL query operations security can be bypassed",
"details" : "### Summary\n\nUsing the Relay special `node` type you can bypass the configured security on an operation.\n\n### Details\n\nHere is an example of how to apply security configurations for the GraphQL operations:\n\n```php\n#[ApiResource(\n security: \"is_granted('ROLE_USER')\",\n operations: [ /* ... */ ],\n graphQlOperations: [\n new Query(security: \"is_granted('ROLE_USER')\"),\n //...\n ],\n)]\nclass Book { /* ... */ }\n```\n\nThis indeed checks `is_granted('ROLE_USER')` as expected for a GraphQL query like the following:\n\n```php\nquery {\n book(id: \"/books/1\") {\n title\n }\n}\n```\n\nBut the security check can be bypassed by using the `node` field (that is available by default) on the root query type like that:\n\n```php\nquery {\n node(id: \"/books/1\") {\n ... on Book {\n title\n }\n }\n}\n```\n\nThis 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.\n\n### Impact\n\nEveryone using GraphQl with the `security` attribute. Not sure whereas this works with custom resolvers nor if this also applies on mutation.\n\nPatched at https://github.com/api-platform/core/commit/60747cc8c2fb855798c923b5537888f8d0969568",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "api-platform/graphql"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0-alpha.1"
}, {
"fixed" : "4.0.22"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "api-platform/core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0-alpha.1"
}, {
"fixed" : "4.0.22"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "api-platform/graphql"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.4.17"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "api-platform/core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.4.17"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "api-platform/graphql"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.1.0-alpha.1"
}, {
"fixed" : "4.1.5"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "api-platform/core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.1.0-alpha.1"
}, {
"fixed" : "4.1.5"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/api-platform/core/security/advisories/GHSA-cg3c-245w-728m"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-31481"
}, {
"type" : "WEB",
"url" : "https://github.com/api-platform/core/commit/55712452b4f630978537bdb2a07dc958202336bb"
}, {
"type" : "WEB",
"url" : "https://github.com/api-platform/core/commit/60747cc8c2fb855798c923b5537888f8d0969568"
}, {
"type" : "WEB",
"url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/api-platform/core/CVE-2025-31481.yaml"
}, {
"type" : "WEB",
"url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/api-platform/graphql/CVE-2025-31481.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/api-platform/core"
}, {
"type" : "WEB",
"url" : "https://github.com/api-platform/core/releases/tag/v3.4.17"
}, {
"type" : "WEB",
"url" : "https://github.com/api-platform/core/releases/tag/v4.1.5"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-863" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2025-04-04T14:07:20Z",
"nvd_published_at" : "2025-04-03T20:15:25Z"
}
}