JS-YAML: Quadratic CPU consumption in !!omap resolution (3.x and 4.x) — CVE-2026-59870 fix not backported
js-yaml versions 3.x and 4.x contain a quadratic CPU consumption vulnerability in the resolution of the !!omap YAML type. The vulnerability arises from a linear scan to enforce key uniqueness, causing CPU usage to grow quadratically with the number of entries. This can lead to denial of service by blocking the Node.js event loop during YAML parsing of attacker-controlled input. The issue is fixed in js-yaml 5.2.1 by using a Set to track keys, but this fix was not backported to the 3.x and 4.x lines.
AI Analysis
Technical Summary
The vulnerability in js-yaml 3.x and 4.x occurs in the resolveYamlOmap() function, which enforces uniqueness of keys in !!omap sequences by performing a linear scan (objectKeys.indexOf) inside a loop over each element. This results in O(n²) CPU complexity relative to the number of entries. Parsing a modestly sized YAML document with many !!omap entries can cause significant CPU consumption and block the Node.js event loop synchronously, leading to denial of service. The 5.x line fixed this by replacing the linear scan with a Set to track seen keys, improving performance to O(n). The fix was introduced in 5.2.1 but was not backported to 3.x or 4.x, so these legacy lines remain vulnerable.
Potential Impact
An attacker can craft a YAML document with a large !!omap sequence to cause js-yaml 3.x or 4.x to consume excessive CPU and block the Node.js event loop synchronously. This results in denial of service for any service parsing untrusted YAML using these versions. The impact is availability-only, with no confidentiality or integrity loss. The attack requires no privileges or user interaction and can be triggered remotely via network input.
Mitigation Recommendations
A patch is available in js-yaml 5.2.1 that fixes this vulnerability by replacing the linear scan with a Set to track keys, reducing CPU complexity to O(n). Users of the 3.x and 4.x lines should upgrade to at least 5.2.1 or later to receive the fix. Since the fix was not backported, continuing to use 3.x or 4.x leaves systems vulnerable. No vendor advisory indicates alternative mitigations or temporary fixes. Therefore, upgrading to a fixed version is the recommended remediation.
JS-YAML: Quadratic CPU consumption in !!omap resolution (3.x and 4.x) — CVE-2026-59870 fix not backported
Description
js-yaml versions 3.x and 4.x contain a quadratic CPU consumption vulnerability in the resolution of the !!omap YAML type. The vulnerability arises from a linear scan to enforce key uniqueness, causing CPU usage to grow quadratically with the number of entries. This can lead to denial of service by blocking the Node.js event loop during YAML parsing of attacker-controlled input. The issue is fixed in js-yaml 5.2.1 by using a Set to track keys, but this fix was not backported to the 3.x and 4.x lines.
CVSS v3.1
Score 7.5high
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability in js-yaml 3.x and 4.x occurs in the resolveYamlOmap() function, which enforces uniqueness of keys in !!omap sequences by performing a linear scan (objectKeys.indexOf) inside a loop over each element. This results in O(n²) CPU complexity relative to the number of entries. Parsing a modestly sized YAML document with many !!omap entries can cause significant CPU consumption and block the Node.js event loop synchronously, leading to denial of service. The 5.x line fixed this by replacing the linear scan with a Set to track seen keys, improving performance to O(n). The fix was introduced in 5.2.1 but was not backported to 3.x or 4.x, so these legacy lines remain vulnerable.
Potential Impact
An attacker can craft a YAML document with a large !!omap sequence to cause js-yaml 3.x or 4.x to consume excessive CPU and block the Node.js event loop synchronously. This results in denial of service for any service parsing untrusted YAML using these versions. The impact is availability-only, with no confidentiality or integrity loss. The attack requires no privileges or user interaction and can be triggered remotely via network input.
Mitigation Recommendations
A patch is available in js-yaml 5.2.1 that fixes this vulnerability by replacing the linear scan with a Set to track keys, reducing CPU complexity to O(n). Users of the 3.x and 4.x lines should upgrade to at least 5.2.1 or later to receive the fix. Since the fix was not backported, continuing to use 3.x or 4.x leaves systems vulnerable. No vendor advisory indicates alternative mitigations or temporary fixes. Therefore, upgrading to a fixed version is the recommended remediation.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-5p4m-2wfm-xmqj
- Osv Schema Version
- 1.4.0
- Ecosystems
- ["npm"]
- Database Specific Severity
- HIGH
- Cvss Version
- 3.1
Threat ID: 6a757440bf8831d539d9a29f
Added to database: 08/07/2026, 05:59:28 UTC
Last enriched: 08/07/2026, 06:11:31 UTC
Last updated: 09/21/2026, 10:24:18 UTC
Views: 76
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.