MEDIUM 6.5

CVE-2026-54164: API Platform Type Confusion in Relation IRI Resolution

API Platform, a popular framework for building REST and GraphQL APIs, contains a type-confusion vulnerability in how it processes related resources. When an API accepts write requests (creating, updating, or patching data), an authenticated attacker can supply a link to a resource of the wrong type, and the system may silently accept it instead of rejecting the mismatch. This corrupts the internal integrity of the data model. The vulnerability affects versions before 4.1.30, 4.2.26, and 4.3.12, though the impact varies depending on whether the API uses older or newer PHP coding patterns.

Source data · NVD / CISA · public domain

CVSS
3.1 · 6.5 MEDIUM · CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N
Weaknesses (CWE)
CWE-843
Affected products
0 configuration(s)
Published / Modified
2026-07-01 / 2026-07-02

NVD description (verbatim)

API Platform Core is a system to create hypermedia-driven REST and GraphQL APIs. In versions prior to 4.1.30, 4.2.26 and 4.3.12, the 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. 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. This issue has been fixed in versions 4.1.30, 4.2.26 and 4.3.12.

2 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability exists in API Platform's AbstractItemNormalizer serializer component, specifically in how it resolves relation IRIs (internationalized resource identifiers). When getResourceFromIri() is invoked to retrieve a related resource, it bypasses the type-guard check normally enforced by IriConverter because no $operation parameter is passed. This allows CWE-843 (type confusion) to occur. For legacy, untyped relation properties (using only @var documentation), a wrongly-typed object is silently assigned to the relation. For modern typed properties (PHP 8.x), Symfony's PropertyAccessor may block the assignment with an InvalidTypeException, providing some defense-in-depth. An authenticated attacker with write permissions can craft a PATCH, POST, or PUT request containing a crafted relation IRI pointing to a resource of a different class than the relation declares, violating application invariants.

Business impact

Successful exploitation corrupts the logical structure of managed data, potentially leading to downstream failures. Depending on application logic, this could result in incorrect business rule enforcement, data model inconsistency, financial calculations or permissions decisions made on mistyped data, or triggering of unintended workflows. The impact is containable if the application uses modern typed properties (PHP 8.x), which will raise exceptions and prevent silent corruption. Legacy codebases using only @var documentation are at higher risk of silent data integrity violations. Regulatory or compliance contexts (healthcare, finance, fintech) may face audit findings if corrupted records are discovered.

Affected systems

API Platform versions prior to 4.1.30, 4.2.26, and 4.3.12 are affected. Organizations running API Platform should verify their deployment version against these thresholds. No vendor-specific products are named, but any custom or commercial API built on API Platform framework is potentially in scope. The vulnerability requires authenticated write access, so public or unauthenticated endpoints are not directly exploitable without first obtaining valid credentials.

Exploitability

The vulnerability requires an authenticated attacker (CVSS:3.1 PR:L) with write permissions to at least one API endpoint. No special user interaction is needed (UI:N), and the attack is straightforward—craft a relation IRI pointing to a mismatched resource type in a write request. The attack surface is moderate: any writable relation property in any API Platform endpoint accessible to an authenticated user is a potential vector. Threat actors with compromised API credentials or insider access could exploit this. The barrier to exploitation is low from a technical standpoint; no complex exploit code or timing attacks are required.

Remediation

Upgrade to API Platform version 4.1.30, 4.2.26, or 4.3.12 or later, depending on your current version line. For versions 4.1.x, upgrade to 4.1.30 or newer. For 4.2.x, upgrade to 4.2.26 or newer. For 4.3.x, upgrade to 4.3.12 or newer. Consult the official API Platform release notes to confirm your target version includes the fix. Test upgrades in a staging environment before production rollout to ensure compatibility with custom extensions or overridden serializers.

Patch guidance

Patches are available in API Platform 4.1.30, 4.2.26, and 4.3.12. Review the official API Platform GitHub repository and release notes for exact patch content and upgrade instructions. The fix addresses the root cause by ensuring that getResourceFromIri() properly validates resource type against the declared relation type before assignment. If you maintain a fork or custom serializer, ensure your override also implements proper type validation. Consider setting up automated dependency monitoring (e.g., Dependabot, Renovate) to alert on new releases and security advisories.

Detection guidance

Monitor API request logs for PATCH, POST, and PUT requests that include relation IRIs pointing to resources of unexpected types. This may appear as mismatches between declared and actual resource class names in IRI parameters. Application logs or database audit trails may reveal unexpected object type assignments to relation properties. In legacy codebases without typed properties, silently-corrupted records may only surface downstream when business logic fails or data quality checks are run. Implement typed properties (PHP 8.x) where possible to enable PropertyAccessor to throw InvalidTypeException, which will surface type-confusion attempts in error logs. Conduct data integrity audits on production systems running unpatched versions to identify corrupted relation assignments.

Why prioritize this

This vulnerability merits timely patching despite CVSS 6.5 (Medium) because it directly undermines data model integrity in applications that serve as data systems of record. Data corruption, even when caught by type checking, can cascade through downstream systems. The vulnerability requires authentication but affects any organization where API users or service accounts have write access. Organizations using older PHP patterns or legacy codebases (no typed properties) face higher risk of silent data corruption. Patch urgency is highest for financial, healthcare, or e-commerce APIs where data integrity directly impacts business logic and regulatory compliance.

Risk score, explained

The CVSS 3.1 score of 6.5 (Medium) reflects: (1) Network-accessible attack surface (AV:N); (2) Low attack complexity—no special conditions required (AC:L); (3) Requirement for authenticated access (PR:L), ruling out unauthenticated abuse; (4) No confidentiality impact (C:N)—the attacker is not reading secrets; (5) High integrity impact (I:H)—data model invariants are violated; (6) No availability impact (A:N)—the service remains operational. The score appropriately penalizes the integrity breach but acknowledges the authentication barrier and lack of availability or confidentiality impact. In environments where write access is restricted to trusted service accounts or internal APIs, practical risk may be lower; in open ecosystems with broad API access, risk approaches higher end of the Medium range.

Frequently asked questions

Can an unauthenticated attacker exploit this vulnerability?

No. The vulnerability requires authenticated write access (PR:L in the CVSS vector). An attacker must possess valid API credentials and have write permissions on at least one relation property. Public or read-only endpoints are not exploitable.

Will modern PHP typed properties protect my application from this vulnerability?

Partially. If your relation properties are declared with PHP 8.x type hints, Symfony's PropertyAccessor will reject the type mismatch and throw an InvalidTypeException, preventing silent corruption. However, legacy codebases using only @var documentation (untyped properties) will silently accept the wrong type, corrupting invariants. Upgrading to the patched version is the primary fix; modernizing code to use typed properties is a defense-in-depth measure.

How do I know if my API Platform deployment is vulnerable?

Check your running version against the fix thresholds: 4.1.30, 4.2.26, and 4.3.12. If you are running 4.1.x below 4.1.30, 4.2.x below 4.2.26, or 4.3.x below 4.3.12, your deployment is vulnerable. Use `composer show apiplatform/core` or check your composer.lock file to determine your exact version.

What is the long-term mitigation if I cannot patch immediately?

Enforce strong authentication and access controls to limit write access to trusted service accounts only. Implement data integrity checks and audit trails to detect unexpected resource type assignments. Modernize legacy code to use typed properties (PHP 8.x), which will cause PropertyAccessor to reject mistyped assignments. These are temporary mitigations only; upgrading is the permanent fix.

This analysis is based on published CVE data as of 2026-07-02 and reflects the vulnerability as described in the official API Platform advisory. Organizations should verify patch availability and compatibility against their specific deployment before production deployment. No exploit code or weaponized proof-of-concept is provided. This vulnerability requires authenticated access; organizations with restricted API write access or advanced type-safety measures (PHP 8.x typed properties) may experience reduced real-world impact. Consult the official API Platform release notes, GitHub repository, and your vendor's security guidance for authoritative remediation steps. SEC.co makes no warranty regarding the completeness or applicability of this analysis to your environment. Source: NVD (public-domain), retrieved 2026-08-10. Analysis generated by SEC.co (claude-haiku-4-5).