Media

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

  • Publicada: 07.08.2026
  • Actualizado: 11.10.2026 10:22

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.

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Paquete de Composer api-platform/core < 4.1.30, >= 4.2.0, < 4.2.26, >= 4.3.0, < 4.3.12 4.1.30, 4.2.26, 4.3.12

Referencias

Puntuación CVSS 6.5/10
Vector CVSS
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N
Debilidad (CWE)
CWE-843
Plataforma
Composer
Paquete
api-platform/core
Publicada
07.08.2026
Actualizado
11.10.2026 10:22

Fuentes y licencias

OSV / GitHub Advisory Database - GHSA-9rjg-x2p2-h68h - CC BY 4.0

Historial de vulnerabilidades: api-platform/core

Todas las vulnerabilidades publicadas de este paquete (Paquete de Composer), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Entradas en total
8
Primera → última
10.2019 08.2026
Sin corrección
0
Explotada en ataques
0

Distribución por gravedad

  • Alta 3
  • Media 5

Divulgaciones por año

  1. 2019: 1
  2. 2020: 0
  3. 2021: 0
  4. 2022: 0
  5. 2023: 1
  6. 2024: 0
  7. 2025: 4
  8. 2026: 2
  1. API Platform Core: Relation IRIs are not type-checked: a related resource can be denormalised as the wrong resource type (type confusion) esta entrada
    Media · 6.5 CVE-2026-54164 < 4.1.30, >= 4.2.0, < 4.2.26, >= 4.3.0, < 4.3.12 4.1.30, 4.2.26, 4.3.12
  2. Media · 5.9 CVE-2026-49858 >= 2.6.0, < 4.1.29, >= 4.2.0, < 4.2.25, >= 4.3.0, < 4.3.8 4.1.29, 4.2.25, 4.3.8
  3. Alta · 7.5 CVE-2025-31485 >= 4.0.0-alpha.1, < 4.0.22, < 3.4.17, >= 4.1.0-alpha.1, < 4.1.5 4.0.22, 3.4.17, 4.1.5
  4. Alta · 7.5 CVE-2025-31481 >= 4.0.0-alpha.1, < 4.0.22, < 3.4.17, >= 4.1.0-alpha.1, < 4.1.5 4.0.22, 3.4.17, 4.1.5
  5. Media · 4.4 CVE-2025-23204 >= 3.3.8, < 3.3.15 3.3.15
  6. Alta · 7.7 CVE-2023-25575 >= 3.0.0, < 3.0.12, >= 3.1.0, < 3.1.3, >= 2.6.0, < 2.7.10 3.0.12, 3.1.3, 2.7.10
  7. Media · 6.5 CVE-2019-1000011 >= 2.2.0, < 2.2.10, >= 2.3.0, < 2.3.6 2.2.10, 2.3.6

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.