CVE-2026-54164

CVE-2026-54164 is a medium-severity type confusion vulnerability in api-platform/core (composer), affecting versions < 4.1.30. It is fixed in 4.1.30, 4.2.26, 4.3.12.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

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

Runtime intelligence, not another scanner.

Summary

API Platform Core: Relation IRIs are not type-checked: a related resource can be denormalised as the wrong resource type (type confusion)

The API Platform serializer's AbstractItemNormalizer does not validate the resource type returned when resolving relation IRIs, allowing type confusion where a resource of an unintended type can be silently assigned to a relation property.

Affected versions

  • api-platform/core < 4.1.30
  • api-platform/core >= 4.2.0, < 4.2.26
  • api-platform/core >= 4.3.0, < 4.3.12

Older major series (2.x, 3.x) ship the same vulnerable code path and are end-of-life; no fix is planned.

Patched versions

  • 4.1.30
  • 4.2.26
  • 4.3.12

Workarounds

Declare a PHP type on every writable relation property (e.g. public ?Foo $relation = null; instead of @var Foo $relation). Symfony's PropertyAccessor will then reject a mismatched object with InvalidTypeException. This does not cover collections of mixed-type interfaces; upgrading to a patched version is the only complete fix.

Proof of concept

A functional test posts a Bar IRI to a Foo-declared relation on an untyped property. Without the fix the server responds with HTTP 201 and the Bar IRI appears in the response payload. With the fix the server responds with HTTP 400 (Invalid IRI "/bars/1").

Full PoC: tests/Functional/Security/TypeConfusionRelationIriTest.php in the patched branches.

References

  • src/Serializer/AbstractItemNormalizer.php, vulnerable relation IRI load
  • src/Symfony/Routing/IriConverter.php, conditional is_a guard (operation-aware path)

Credit

Reported by @alexandre-daubois.

Impact

An attacker who can submit write requests (POST/PUT/PATCH) to an API Platform endpoint with writable relations can supply a relation IRI pointing to a resource of a different type than the relation's declared class. Because getResourceFromIri() does not pass an $operation to IriConverter::getResourceFromIri(), the is_a type guard at IriConverter.php:86 is skipped. For untyped relation properties (legacy @var-only style), the wrong-typed object is silently assigned, corrupting invariants and potentially feeding downstream logic that assumes the declared type (CWE-843). For typed properties (modern PHP 8.x), the substitution is blocked by Symfony's PropertyAccessor with an InvalidTypeException.

An object is accessed using a type that is incompatible with its actual type, causing the runtime to interpret memory incorrectly. Typical impact: memory safety violations, unexpected behavior, or code execution.

CVE-2026-54164 has a CVSS score of 6.5 (Medium). The vector is network-reachable, low 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 (4.1.30, 4.2.26, 4.3.12); upgrading removes the vulnerable code path.

Affected versions

api-platform/core (< 4.1.30) api-platform/core (>= 4.2.0, < 4.2.26) api-platform/core (>= 4.3.0, < 4.3.12)

Security releases

api-platform/core → 4.1.30 (composer) api-platform/core → 4.2.26 (composer) api-platform/core → 4.3.12 (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

An is_a guard is added inside AbstractItemNormalizer::getResourceFromIri() (and the equivalent inline call sites on 4.1) so that a mismatched IRI throws InvalidArgumentException, mirroring the operation-aware check the IriConverter already performs when an operation is supplied. This forces a 400 Bad Request response for cross-type IRIs instead of a silent assignment.

Frequently Asked Questions

  1. What is CVE-2026-54164? CVE-2026-54164 is a medium-severity type confusion vulnerability in api-platform/core (composer), affecting versions < 4.1.30. It is fixed in 4.1.30, 4.2.26, 4.3.12. An object is accessed using a type that is incompatible with its actual type, causing the runtime to interpret memory incorrectly.
  2. How severe is CVE-2026-54164? CVE-2026-54164 has a CVSS score of 6.5 (Medium). 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 versions of api-platform/core are affected by CVE-2026-54164? api-platform/core (composer) versions < 4.1.30 is affected.
  4. Is there a fix for CVE-2026-54164? Yes. CVE-2026-54164 is fixed in 4.1.30, 4.2.26, 4.3.12. Upgrade to this version or later.
  5. Is CVE-2026-54164 exploitable, and should I be worried? Whether CVE-2026-54164 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-2026-54164 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-2026-54164?
    • Upgrade api-platform/core to 4.1.30 or later
    • Upgrade api-platform/core to 4.2.26 or later
    • Upgrade api-platform/core to 4.3.12 or later

Other vulnerabilities in api-platform/core

Stop the waste.
Protect your environment with Kodem.