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.

Check whether CVE-2025-31485 affects your applications

Kodem tells you whether this CVE is present, reachable, and actually executing in your application, so you know if it matters.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence. Only the CVEs that actually run in production.

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

api-platform/graphql (< 3.4.17) api-platform/core (< 3.4.17) api-platform/graphql (>= 4.0.0-alpha.1, < 4.0.22) api-platform/core (>= 4.0.0-alpha.1, < 4.0.22) api-platform/core (>= 4.1.0-alpha.1, < 4.1.5) api-platform/graphql (>= 4.1.0-alpha.1, < 4.1.5)

Security releases

api-platform/graphql → 3.4.17 (composer) api-platform/core → 3.4.17 (composer) api-platform/graphql → 4.0.22 (composer) api-platform/core → 4.0.22 (composer) api-platform/core → 4.1.5 (composer) api-platform/graphql → 4.1.5 (composer)

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

Upgrade the following packages to resolve this vulnerability:

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

  1. 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.
  2. 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.
  3. Which packages are affected by CVE-2025-31485?
    • api-platform/graphql (composer) (versions < 3.4.17)
    • api-platform/core (composer) (versions < 3.4.17)
  4. 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.
  5. 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
  6. 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.
  7. How do I fix CVE-2025-31485?
    • Upgrade api-platform/graphql to 3.4.17 or later
    • Upgrade api-platform/core to 3.4.17 or later
    • Upgrade api-platform/graphql to 4.0.22 or later
    • Upgrade api-platform/core to 4.0.22 or later
    • Upgrade api-platform/core to 4.1.5 or later
    • Upgrade api-platform/graphql to 4.1.5 or later

Other vulnerabilities in api-platform/graphql

Stop the waste.
Protect your environment with Kodem.