npm
GHSA-5p4m-2wfm-xmqj
JS-YAML: Quadratic CPU consumption in !!omap resolution (3.x and 4.x) — CVE-2026-59870 fix not backported
- Severity
- High 7.5
- Published
- 6 Aug 2026
- Last changed
- 10 Sept 2026
- Added to UpHeron
- 22 Oct 2026
- Fixed in
- 3.15.1, 4.3.1
- Attack
- Over the network · No login needed · No user action needed
- Attacker can
- Take it down
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H- Sources
- OSV.dev and GitHub
Description
resolveYamlOmap() enforces key uniqueness for !!omap sequences with a linear scan (objectKeys.indexOf(...)) inside the per-element loop, making resolution O(n²) in the number of entries. A modestly sized YAML document therefore consumes disproportionate CPU inside yaml.load(), giving a denial of service against any consumer that parses untrusted YAML.
!!omap is registered in the default schema (lib/schema/default.js → require('../type/omap')), so a plain yaml.load(untrustedInput) with no options is affected — no custom schema or non-default configuration is required.
This is the same weakness as CVE-2026-59870 / GHSA-724g-mxrg-4qvm, which was fixed in the 5.x line in 5.2.1. That fix was never backported: both currently maintained legacy lines still carry the original implementation.
lib/type/omap.js (js-yaml 4.3.0):
objectKeys grows by one element per entry, and Array.prototype.indexOf is a linear scan, so resolving an n-entry !!omap performs roughly 1 + 2 + … + n comparisons —…
Affected software
| Software | Affected versions |
|---|---|
js-yamlnpm · osv:npm:js-yaml |
|
About js-yaml
- Weekly downloads (npm)
- 399,660,092npm, 17 Nov 2026
Vulnerabilities in js-yaml
- In our list
- 4
- Published in the last 12 months
- 4
- Critical, last 12 months
- 0
- High, last 12 months
- 3
- Known exploited
- 0
- CVE-2026-84375js-yaml: maxTotalMergeKeys does not limit CPU use for empty merge sourcesHigh 7.5 8 Sept 2026
- CVE-2026-59869js-yaml: YAML merge-key chains can force quadratic CPU consumptionHigh 7.5 20 Jul 2026
- CVE-2026-53550JS-YAML: Quadratic-complexity DoS in merge key handling via repeated aliasesMedium 5.3 15 Jun 2026
References
- GitHub Advisory Database https://github.com/advisories/GHSA-5p4m-2wfm-xmqj