Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…
EPSS 0.2%top 90%

CVE-2026-54164: CWE-843: Access of Resource Using Incompatible Type ('Type Confusion') in api-platform core

0
Medium
Published: 08/07/2026 (08/07/2026, 16:54:42 UTC)
Source: CVE Database V5
Vendor/Project: api-platform
Product: core

Description

## Summary 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. ## 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`. ## 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` ## Fix 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. ## 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.

CVSS v3.1

Score 6.5medium

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

Affected software

GitHub Actionsmore threats →ai
api-platform/core
pkg:github/api-platform/core
Affected versions
<4.1.30<4.2.26<4.3.12

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 08/08/2026, 15:38:43 UTC

Technical Analysis

The API Platform serializer's AbstractItemNormalizer does not validate the resource type returned when resolving relation IRIs, allowing type confusion (CWE-843). An attacker able to submit write requests to endpoints with writable relations can supply a relation IRI pointing to a resource of a different type than declared. Because getResourceFromIri() lacks an operation parameter, the is_a type guard in IriConverter is skipped, allowing silent assignment of wrong-typed objects to untyped relation properties. This corrupts invariants and may cause downstream logic errors. Typed PHP 8.x properties prevent this by throwing InvalidTypeException. The vulnerability affects api-platform/core versions <4.1.30, >=4.2.0 <4.2.26, and >=4.3.0 <4.3.12. Older major versions 2.x and 3.x are also vulnerable but end-of-life with no planned fix. The patch adds an is_a guard in AbstractItemNormalizer::getResourceFromIri() to throw InvalidArgumentException on mismatched IRIs, resulting in a 400 Bad Request response instead of silent assignment. Workarounds include declaring PHP types on writable relation properties to leverage Symfony's PropertyAccessor type checks, but upgrading to a patched version is the only complete fix.

Potential Impact

An attacker with permission to submit write requests (POST/PUT/PATCH) to API Platform endpoints with writable relations can cause type confusion by assigning a resource of an unintended type to a relation property. This can silently corrupt application invariants and potentially cause incorrect behavior in downstream logic that assumes the declared type. The vulnerability does not impact confidentiality or availability directly but can lead to integrity issues. Typed properties in PHP 8.x mitigate the issue by throwing exceptions, but untyped properties remain vulnerable. There are no known exploits in the wild.

Mitigation Recommendations

A fix is available in api-platform/core versions 4.1.30, 4.2.26, and 4.3.12 that adds a type guard to reject mismatched IRIs with a 400 Bad Request error. Users should upgrade to one of these patched versions to fully remediate the vulnerability. As a partial workaround, declaring explicit PHP types on all writable relation properties will cause Symfony's PropertyAccessor to reject mismatched types with an InvalidTypeException, but this does not cover collections of mixed-type interfaces. Older major versions 2.x and 3.x are end-of-life and have no planned fixes, so upgrading is strongly recommended.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2026-06-11T21:46:52.380Z
Cvss Version
3.1
State
PUBLISHED
Remediation Level
null

Threat ID: 6a456fd127e9c79719097e66

Added to database: 07/01/2026, 19:51:45 UTC

Last enriched: 08/08/2026, 15:38:43 UTC

Last updated: 08/14/2026, 00:41:13 UTC

Views: 91

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses