CVE-2025-31485: Api platform/graphql GraphQL Grant On A Property Vulnerability

HIGH
Advisory Identifier: GHSA-428q-q3vv-3fq3
CVSS 7.5
CWE-696
Published
Advisory Summary

CVE-2025-31485 is a HIGH (CVSS 7.5) graphql grant on a property vulnerability (CWE-696: Incorrect Behavior Order) affecting Api platform/graphql libraries in the Packagist ecosystem. The issue involves graphql grant on a property might be cached with different objects. Remediation is available by upgrading affected packages to version 4.0.22, 3.4.17, 4.1.5.

CVE-2025-31485 at a Glance

CVE Identifier CVE-2025-31485
GHSA Identifier GHSA-428q-q3vv-3fq3
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-696: Incorrect Behavior Order
Affected Product Api platform/graphql
Package Ecosystem Packagist
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2025-31485

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.

api-platform/graphql fixed: 4.0.22
Upgrade api-platform/graphql to 4.0.22
api-platform/core fixed: 4.0.22
Upgrade api-platform/core to 4.0.22
api-platform/graphql fixed: 3.4.17
Upgrade api-platform/graphql to 3.4.17
api-platform/core fixed: 3.4.17
Upgrade api-platform/core to 3.4.17
api-platform/core fixed: 4.1.5
Upgrade api-platform/core to 4.1.5
api-platform/graphql fixed: 4.1.5
Upgrade api-platform/graphql to 4.1.5
Verify Direct and Transitive Dependencies

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-31485, 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-696: Incorrect Behavior Order, where the product performs multiple related behaviors, but the behaviors are performed in the wrong order in ways that may produce resultant weaknesses. 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

### 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. ### Impact It grants access to properties that it should not. ### Workarounds Override the ItemNormalizer. Patched at: https://github.com/api-platform/core/commit/7af65aad13037d7649348ee3dcd88e084ef771f8

CVE-2025-31485 Affected Api platform/graphql Versions

6 component(s)
Fixed Versions:
4.0.223.4.174.1.5
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/core
Packagist
≥ 4.1.0-alpha.1
< 4.1.5
4.1.5
api-platform/graphql
Packagist
≥ 4.1.0-alpha.1
< 4.1.5
4.1.5

References

Frequently Asked Questions

What is CVE-2025-31485?
CVE-2025-31485 is a security vulnerability in Api platform/graphql involving GraphQL grant on a property might be cached with different objects under CWE-696: Incorrect Behavior Order.
Which Api platform/graphql versions are affected?
Affected versions include releases prior to 4.0.22, 3.4.17, 4.1.5 across affected packages: api-platform/graphql, api-platform/core.
What version fixes CVE-2025-31485?
Upgrading to 4.0.22, 3.4.17, 4.1.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is api-platform/graphql affected?
Yes, api-platform/graphql is affected in releases prior to 4.0.22, 3.4.17, 4.1.5. Upgrade your dependency to 4.0.22, 3.4.17, 4.1.5 or later.
Is api-platform/core affected?
Yes, api-platform/core is affected in releases prior to 4.0.22, 3.4.17, 4.1.5. Upgrade your dependency to 4.0.22, 3.4.17, 4.1.5 or later.
What is the CVSS score of CVE-2025-31485?
CVE-2025-31485 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2025-31485?
CVE-2025-31485 is classified under CWE-696: Incorrect Behavior Order (The product performs multiple related behaviors, but the behaviors are performed in the wrong order in ways that may produce resultant weaknesses.).
How can I check Packagist dependencies for CVE-2025-31485?
Run the dependency tree command: 'inspect dependencies for api-platform/graphql'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-428q-q3vv-3fq3",
  "modified" : "2025-08-29T21:08:09Z",
  "published" : "2025-04-04T14:19:42Z",
  "aliases" : [ "CVE-2025-31485" ],
  "summary" : "GraphQL grant on a property might be cached with different objects",
  "details" : "### 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",
  "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/core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.1.0-alpha.1"
      }, {
        "fixed" : "4.1.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "api-platform/graphql"
    },
    "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-428q-q3vv-3fq3"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-31485"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/api-platform/core/commit/7af65aad13037d7649348ee3dcd88e084ef771f8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/api-platform/core/commit/cba3acfbd517763cf320167250c5bed6d569696a"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/api-platform/core/CVE-2025-31485.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/api-platform/graphql/CVE-2025-31485.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/api-platform/core"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/api-platform/core/releases/tag/v3.4.17"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-696" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-04-04T14:19:42Z",
    "nvd_published_at" : "2025-04-03T20:15:25Z"
  }
}