CVE-2026-59869: js-yaml: YAML merge-key chains can force quadratic CPU consumption
js-yaml can spend quadratic CPU time parsing a document whose size grows only linearly. The issue is triggered by a chain of mappings where each mapping merges the previous one:
a0: &a0 { k0: 0 }
a1: &a1 { <<: *a0, k1: 1 }
a2: &a2 { <<: *a1, k2: 2 }
a3: &a3 { <<: *a2, k3: 3 }
...
b: *aN
For each new mapping, the loader has to enumerate the keys inherited from the previous mapping. With N chained mappings, this results in roughly 1 + 2 + … + N merged-key visits, i.e., O(N^2) work for O(N) input size.
References
- github.com/advisories/GHSA-52cp-r559-cp3m
- github.com/nodeca/js-yaml/commit/24f13e79ee1343a7e30bd6f6c9d9cdbf0ac9b2b7
- github.com/nodeca/js-yaml/commit/59423c6f8cdc78742ac00e25a4dd39ef16b702e4
- github.com/nodeca/js-yaml/releases/tag/3.15.0
- github.com/nodeca/js-yaml/releases/tag/4.3.0
- github.com/nodeca/js-yaml/security/advisories/GHSA-52cp-r559-cp3m
- nvd.nist.gov/vuln/detail/CVE-2026-59869
Code Behaviors & Features
Detect and mitigate CVE-2026-59869 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →