Alta

Immutable: Hash-collision algorithmic complexity denial of service in Immutable.Map/Set

  • Publicada: 21.07.2026
  • Actualizado: 11.10.2026 10:22

Summary

Immutable.Map and Immutable.Set keep keys that share the same 32-bit hash in a collision bucket that is scanned linearly. The string hash is public and deterministic, so an attacker who controls the keys inserted into a Map can craft many keys that all collide, degrading insertion and lookup from amortized O(1) to O(n) per operation — and O(n²) to build or read the whole set. A small, attacker-shaped payload can therefore consume disproportionate CPU and, on a single-threaded runtime such as Node.js, stall the event loop and deny service.

Details

The string hash uses the JVM-style polynomial hashed = (31 * hashed + charCode) | 0. Strings such as "Aa" and "BB" hash to the same value (65*31+97 == 66*31+66 == 2112), and concatenating such blocks yields 2^n distinct strings sharing one hash (40 characters ⇒ >1,000,000 colliding keys). All such keys route to a single HashCollisionNode, whose get/update walk the entire bucket testing is(). There is no per-process salt, so the colliding set is fully precomputable from the open-source algorithm.

Proof of concept

Inserting N colliding keys (e.g. via Immutable.Map(obj) / Immutable.fromJS(obj)) is O(N²). Measured on one machine, ~8,000 colliding keys take ~0.7 s to build and ~0.6 s to read, scaling ×4 per doubling; ~16,000 keys exceed several seconds.

Impact

CPU-bound denial of service in applications that ingest attacker-controlled object keys into Immutable structures, e.g. Immutable.Map(req.body), Immutable.fromJS(req.body), state.merge(userObject) / mergeDeep(...). Applications that only store attacker input as values under fixed keys are not affected.

Affected versions

  • = 4.0.0-beta.1, < 4.3.9

  • = 5.0.0-beta.1, < 5.1.8

  • < 3.8.4

Patches

Fixed in 5.1.8 (adjust to the actual release): large collision buckets are indexed by a per-process seeded secondary hash, restoring near-linear behavior for the affected paths. The public hash() is unchanged (no breaking change), and is() remains the sole authority on key equality. Also fixed in 4.3.9 and 3.8.4.

Workarounds

Before passing untrusted data to Immutable.js: cap request body size, limit object key count/length, and reject high-cardinality payloads; avoid building Maps directly from untrusted object keys.

References

  • CWE-407 (Inefficient Algorithmic Complexity), CWE-400 (Uncontrolled Resource Consumption)
  • OWASP API4:2023 (Unrestricted Resource Consumption)

Software afectado

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

PlataformaPaqueteVersiones vulnerablesCorregida en
Paquete de npm immutable >= 4.0.0-beta.1, < 4.3.9, >= 5.0.0-beta.1, < 5.1.8, < 3.8.4 4.3.9, 5.1.8, 3.8.4

Referencias

Puntuación CVSS -
Vector CVSS
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
Debilidad (CWE)
CWE-400, CWE-407
Plataforma
npm
Paquete
immutable
Publicada
21.07.2026
Actualizado
11.10.2026 10:22

Fuentes y licencias

OSV / GitHub Advisory Database - GHSA-xvcm-6775-5m9r - CC BY 4.0

Historial de vulnerabilidades: immutable

Todas las vulnerabilidades publicadas de este paquete (Paquete de npm), 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
3
Primera → última
03.2026 07.2026
Sin corrección
0
Explotada en ataques
0

Distribución por gravedad

  • Alta 3

Divulgaciones por año

  1. 2026: 3
  1. Immutable: Hash-collision algorithmic complexity denial of service in Immutable.Map/Set esta entrada
    Alta CVE-2026-59880 >= 4.0.0-beta.1, < 4.3.9, >= 5.0.0-beta.1, < 5.1.8, < 3.8.4 4.3.9, 5.1.8, 3.8.4
  2. Alta · 7.5 CVE-2026-59879 >= 4.0.0-rc.1, < 4.3.9, >= 5.0.0-beta.1, < 5.1.8, < 3.8.4 4.3.9, 5.1.8, 3.8.4
  3. Alta · 9.8 CVE-2026-29063 >= 4.0.0-rc.1, < 4.3.8, >= 5.0.0, < 5.1.5, < 3.8.3 4.3.8, 5.1.5, 3.8.3

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.