Aug 7, 2026·6 min read·25 visits
API Platform Core failed to validate resource types retrieved via relation IRIs, causing Type Confusion in environments with untyped properties.
CVE-2026-54164 is a class/type confusion vulnerability (CWE-843) in API Platform Core. When processing relationships via Internationalized Resource Identifiers (IRIs) in write requests, the framework's normalizer fails to verify if the resolved resource matches the expected type. For PHP applications utilizing untyped properties, the mismatched object is silently assigned, breaking domain logic and data integrity.
API Platform Core is a widely adopted PHP framework designed to build hypermedia-driven REST and GraphQL APIs. One of its key capabilities is handling relational structures via Internationalized Resource Identifiers (IRIs). During write requests such as POST, PUT, or PATCH, the framework parses these incoming identifiers and resolves them to active database entity instances.
This vulnerability, tracked as CVE-2026-54164, lies within the deserialization routine of relations in the AbstractItemNormalizer. When parsing external representation payloads, the class resolves relation values through an IRI converter. However, it fails to perform an essential class-matching assertion on the retrieved entity, creating a path for type confusion.
The attack surface exists on all writable endpoints that accept links or associations to other entities. If an application utilizes looser PHP constructs like untyped variables, this failure to validate types leads to silent assignment of mismatched entities into relational slots. This bypasses the structural assumptions established in database models and business logic.
To map an IRI such as /api/foos/1 back to a PHP entity, the serializer's AbstractItemNormalizer invokes IriConverter::getResourceFromIri(). By design, the IriConverter class possesses a type-checking check via the is_a() function to confirm compatibility with the target resource class. Crucially, this type-checking condition only fires if an explicit operational context is supplied to the converter.
In vulnerable versions of API Platform Core, both the AbstractItemNormalizer::getResourceFromIri() and AbstractItemNormalizer::denormalizeRelation() methods request entity resolution without providing this vital operation argument. Because of this omission, the validation routines within the converter are completely skipped during standard deserialization of related resources.
When a mismatched IRI is supplied, the serializer relies on Symfony's PropertyAccessor component to assign the resolved object to the parent model. If the property uses modern PHP native types, Symfony's accessor triggers an exception and aborts. However, if the property is untyped or relies strictly on PHPDoc annotations, the PHP engine silently permits the assignment, resulting in type confusion.
Comparing the vulnerable implementation against the patched codebase illustrates the type validation failure. In vulnerable iterations of src/Serializer/AbstractItemNormalizer.php, the IRI resolution was executed with no secondary type verification.
// Vulnerable Implementation
private function getResourceFromIri(string $data, array $context, string $resourceClass): ?object
{
try {
// The resolved object is returned directly without validating its type against $resourceClass
return $this->iriConverter->getResourceFromIri($data, $context + ['fetch_data' => true]);
} catch (ItemNotFoundException $e) {
// ...
}
}The corresponding fix introduces an explicit assertion directly inside the normalizer. This ensures that even when the underlying IRI converter does not enforce type validation, the deserialization loop halts on type mismatches.
// Patched Implementation
private function getResourceFromIri(string $data, array $context, string $resourceClass): ?object
{
try {
$item = $this->iriConverter->getResourceFromIri($data, $context + ['fetch_data' => true]);
// Explicit type-confusion guard added in the patch
if (!is_a($item, $resourceClass)) {
throw new InvalidArgumentException(\sprintf('The iri "%s" does not reference the correct resource.', $data));
}
return $item;
} catch (ItemNotFoundException $e) {
// ...
}
}This implementation uses is_a() to perform the verification. This ensures that polymorphically compatible models, such as subclasses of the target relation, continue to deserialize correctly while rejecting unrelated types.
An attacker seeking to exploit this flaw first performs passive reconnaissance on the API to map write-enabled endpoints that contain object relations. If an endpoint accepts relation writes but maps them to properties without strict PHP type declarations, it is highly susceptible to this attack.
To perform the injection, the attacker constructs a payload targeting a valid entity, such as Target. The Target model expects a relation pointing to a class of type Foo. However, the attacker replaces the IRI with a reference to class Bar, pointing to /type-confusion/bars/1.
Upon submission, the normalizer processes the request. Because the internal validation guard is missing, the normalizer deserializes the Bar instance and successfully binds it to the parent property. The target application then persists the state or forwards the model to downstream domain operations, where the presence of the unexpected type triggers logical errors.
The severity of CVE-2026-54164 is scored at 6.5 (Medium) using the CVSS v3.1 scoring standard. The attack vector is Network, execution complexity is low, and privileges required are low, meaning any authenticated client authorized to interact with the API can trigger the issue.
The integrity impact of this vulnerability is classified as High. By causing type confusion, an attacker can substitute sensitive reference models with irrelevant or unauthorized models, violating business rules and data constraints. If the system relies on entity types to execute state changes, this confusion could lead to security control bypasses.
No direct evidence suggests active exploitation of this flaw in the wild. Its EPSS score sits at a low 0.00195, suggesting limited automated targeting. However, because applications relying on legacy structures fail silently, the vulnerability poses a silent threat to legacy PHP applications.
The most robust remediation is to upgrade API Platform Core to a patched release. The fix is available in versions 4.1.30, 4.2.26, and 4.3.12. Upgrading is performed via Composer by running composer update api-platform/core.
As a critical defensive practice, developers must migrate legacy codebase elements away from loose variable declarations. Properties must use native PHP strict types rather than relying solely on PHPDoc annotations. This forces Symfony's PropertyAccessor to reject type-mismatched assignments natively, creating a fallback security barrier.
// Secure configuration using strict typing
class Target
{
// Strictly typed property naturally blocks assignment of mismatched classes
public ?App\Entity\Foo $relation = null;
}Additionally, applications that implement custom serializers should ensure they explicitly validate all objects returned from the IRI converter against their expected target classes. Static analysis tools, such as PHPStan or Psalm, should be integrated into continuous deployment pipelines to discover and enforce strict property type-hints across entity schemas.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
API Platform Core api-platform | < 4.1.30 | 4.1.30 |
API Platform Core api-platform | >= 4.2.0, < 4.2.26 | 4.2.26 |
API Platform Core api-platform | >= 4.3.0, < 4.3.12 | 4.3.12 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-843 |
| Attack Vector | Network |
| CVSS v3.1 | 6.5 (Medium) |
| EPSS Score | 0.00195 |
| Exploit Status | poc |
| CISA KEV | Not Listed |
The product allocates or accesses a resource of one type, but later accesses that resource using a type that is incompatible with the original type.
NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.
CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.
CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.
CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.
A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.
CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.