{"id":"CVE-2025-31481","aliases":["CVE-2025-31481","GHSA-cg3c-245w-728m"],"related":[],"kind":"vulnerability","state":"published","title":"GraphQL query operations security can be bypassed","summary":"API Platform Core is a system to create hypermedia-driven REST and GraphQL APIs. Using the Relay special node type you can bypass the configured security on an operation. This vulnerability is fixed in 4.0.22 and 3.4.17.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"API Platform Core is a system to create hypermedia-driven REST and GraphQL APIs. Using the Relay special node type you can bypass the configured security on an operation. This vulnerability is fixed in 4.0.22 and 3.4.17.","source":"cvelist"},{"lang":"en","text":"### 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\n‌query {\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\n‌query {\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","format":"markdown","source":"ghsa"},{"lang":"es","text":"API Platform Core es un sistema para crear API REST y GraphQL basadas en hipermedia. Mediante el tipo de nodo especial Relay, se puede eludir la seguridad configurada en una operación. Esta vulnerabilidad se corrigió en la versión 4.0.22.","source":"nvd"}],"published":"2025-04-03T19:20:22.916Z","modified":"2026-06-17T09:10:28.647Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-863"],"affected":[{"ranges":[{"version":">= 4.0.0, < 4.0.22","status":"affected"},{"version":"< 3.4.17","status":"affected"}],"vendor":"api-platform","product":"core","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"4.0.0-alpha.1","status":"affected","fixed":"4.0.22"}],"ecosystem":"Packagist","package":"api-platform/graphql","purl":"pkg:composer/api-platform/graphql","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"4.0.0-alpha.1","status":"affected","fixed":"4.0.22"}],"ecosystem":"Packagist","package":"api-platform/core","purl":"pkg:composer/api-platform/core","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.4.17"}],"ecosystem":"Packagist","package":"api-platform/graphql","purl":"pkg:composer/api-platform/graphql","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.4.17"}],"ecosystem":"Packagist","package":"api-platform/core","purl":"pkg:composer/api-platform/core","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"4.1.0-alpha.1","status":"affected","fixed":"4.1.5"}],"ecosystem":"Packagist","package":"api-platform/graphql","purl":"pkg:composer/api-platform/graphql","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"4.1.0-alpha.1","status":"affected","fixed":"4.1.5"}],"ecosystem":"Packagist","package":"api-platform/core","purl":"pkg:composer/api-platform/core","source":"ghsa"}],"references":[{"url":"https://github.com/api-platform/core/security/advisories/GHSA-cg3c-245w-728m","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/api-platform/core/commit/55712452b4f630978537bdb2a07dc958202336bb","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/api-platform/core/commit/60747cc8c2fb855798c923b5537888f8d0969568","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/api-platform/core/releases/tag/v3.4.17","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-31481","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/api-platform/core/CVE-2025-31481.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/api-platform/graphql/CVE-2025-31481.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/api-platform/core","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/api-platform/core/releases/tag/v4.1.5","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2025-04-03T19:39:57.000Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-31481","url":"https://www.cve.org/CVERecord?id=CVE-2025-31481","licence":"CVE Terms of Use","modified":"2025-04-08T13:14:36.379Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-cg3c-245w-728m","url":"https://github.com/advisories/GHSA-cg3c-245w-728m","licence":"CC-BY-4.0","modified":"2025-08-29T21:35:33.406Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-31481","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-31481","licence":"Public domain","modified":"2026-06-17T09:10:28.647Z"}],"updatedAt":"2026-11-25T22:58:56.022Z","epss":{"score":0.00475,"percentile":0.42692,"date":"2026-12-01T12:00:22.000Z"}}