Summary
GraphQL grant on a property might be cached with different objects
Full technical description
Original message:
I found an issue with security grants on on properties in the GraphQL ItemNormalizer:
If 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.
There 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
and 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.
Workarounds
Override the ItemNormalizer.
Patched at: https://github.com/api-platform/core/commit/7af65aad13037d7649348ee3dcd88e084ef771f8
Impact
It grants access to properties that it should not.
CVE-2025-31485 has a CVSS score of 7.5 (High). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (3.4.17, 4.0.22, 4.1.5); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
api-platform/graphql to 3.4.17 or later; api-platform/core to 3.4.17 or later; api-platform/graphql to 4.0.22 or later; api-platform/core to 4.0.22 or later; api-platform/core to 4.1.5 or later; api-platform/graphql to 4.1.5 or later
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2025-31485? CVE-2025-31485 is a high-severity security vulnerability in api-platform/graphql (composer), affecting versions < 3.4.17. It is fixed in 3.4.17, 4.0.22, 4.1.5.
- How severe is CVE-2025-31485? CVE-2025-31485 has a CVSS score of 7.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which packages are affected by CVE-2025-31485?
api-platform/graphql(composer) (versions < 3.4.17)api-platform/core(composer) (versions < 3.4.17)
- Is there a fix for CVE-2025-31485? Yes. CVE-2025-31485 is fixed in 3.4.17, 4.0.22, 4.1.5. Upgrade to this version or later.
- Is CVE-2025-31485 exploitable, and should I be worried? Whether CVE-2025-31485 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2025-31485 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2025-31485?
- Upgrade
api-platform/graphqlto 3.4.17 or later - Upgrade
api-platform/coreto 3.4.17 or later - Upgrade
api-platform/graphqlto 4.0.22 or later - Upgrade
api-platform/coreto 4.0.22 or later - Upgrade
api-platform/coreto 4.1.5 or later - Upgrade
api-platform/graphqlto 4.1.5 or later
- Upgrade