{"id":"CVE-2025-31485","aliases":["CVE-2025-31485","GHSA-428q-q3vv-3fq3"],"related":[],"kind":"vulnerability","state":"published","title":"GraphQL grant on a property might be cached with different objects","summary":"API Platform Core is a system to create hypermedia-driven REST and GraphQL APIs. Prior to 4.0.22 and 3.4.17, a GraphQL grant on a property might be cached with different objects. The ApiPlatform\\GraphQl\\Serializer\\ItemNormalizer::isCacheKeySafe() method is meant to prevent the caching but the parent::normalize method that is called afterwards still creates the cache key and causes the issue. 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. Prior to 4.0.22 and 3.4.17, a GraphQL grant on a property might be cached with different objects. The ApiPlatform\\GraphQl\\Serializer\\ItemNormalizer::isCacheKeySafe() method is meant to prevent the caching but the parent::normalize method that is called afterwards still creates the cache key and causes the issue. This vulnerability is fixed in 4.0.22 and 3.4.17.","source":"cvelist"},{"lang":"en","text":"### Original message:\n\nI found an issue with security grants on on properties in the GraphQL ItemNormalizer:\n\nIf you use something like `#[ApiProperty(security: 'is_granted(\"PROPERTY_READ\", [object, property])')]` on a member of an entity, the grant gets cached and is only evaluated once, even if the `object` in question is a different one.\n\nThere is the `ApiPlatform\\GraphQl\\Serializer\\ItemNormalizer::isCacheKeySafe()` method that seems to be intended to prevent this: https://github.com/api-platform/core/blob/88f5ac50d20d6510686a7552310cc567fcca45bf/src/GraphQl/Serializer/ItemNormalizer.php#L160-L164  \nand in its usage on line 90 it does indeed not create a cache key, but the `parent::normalize()` that is called afterwards still creates the cache key and causes the issue.\n\n### Impact\n\nIt grants access to properties that it should not.\n\n### Workarounds\n\nOverride the ItemNormalizer.\n\nPatched at: https://github.com/api-platform/core/commit/7af65aad13037d7649348ee3dcd88e084ef771f8","format":"markdown","source":"ghsa"},{"lang":"es","text":"API Platform Core es un sistema para crear API REST y GraphQL basadas en hipermedia. Antes de la versión 4.0.22, una concesión GraphQL en una propiedad podía almacenarse en caché con diferentes objetos. El método ApiPlatform\\GraphQl\\Serializer\\ItemNormalizer::isCacheKeySafe() impide el almacenamiento en caché, pero el método parent::normalize, que se invoca posteriormente, sigue creando la clave de caché y causando el problema. Esta vulnerabilidad se corrigió en la versión 4.0.22.","source":"nvd"}],"published":"2025-04-03T19:31:46.021Z","modified":"2026-06-17T09:10:29.063Z","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-696"],"affected":[{"ranges":[{"version":">= 4.0.0-alpha.1, < 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/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"}],"references":[{"url":"https://github.com/api-platform/core/security/advisories/GHSA-428q-q3vv-3fq3","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/api-platform/core/commit/7af65aad13037d7649348ee3dcd88e084ef771f8","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/api-platform/core/commit/cba3acfbd517763cf320167250c5bed6d569696a","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-31485","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/api-platform/core/CVE-2025-31485.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/api-platform/graphql/CVE-2025-31485.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/api-platform/core","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2025-04-03T19:59:34.529Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-31485","url":"https://www.cve.org/CVERecord?id=CVE-2025-31485","licence":"CVE Terms of Use","modified":"2025-04-08T13:15:23.510Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-428q-q3vv-3fq3","url":"https://github.com/advisories/GHSA-428q-q3vv-3fq3","licence":"CC-BY-4.0","modified":"2025-08-29T21:36:30.705Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-31485","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-31485","licence":"Public domain","modified":"2026-06-17T09:10:29.063Z"}],"updatedAt":"2026-11-25T22:58:56.022Z","epss":{"score":0.00626,"percentile":0.51345,"date":"2026-12-01T12:00:22.000Z"}}