Skip to main content

JS-YAML: Quadratic CPU consumption in !!omap resolution (3.x and 4.x) — CVE-2026-59870 fix not backported

0
High
Published: 08/06/2026 (08/06/2026, 20:27:32 UTC)
Source: GCVE Database
Product: js-yaml

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

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Affected software

npmghsa
js-yaml
Affected versions
>=4.0.0 <4.3.1
npmghsa
js-yaml
Affected versions
>=3.0.0 <3.15.1

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 08/07/2026, 06:11:31 UTC

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.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

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 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

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

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses