CVE-2026-59870: js-yaml Denial-of-Service via Ordered-Map Parsing
js-yaml, a popular JavaScript library for parsing YAML files, contains a performance vulnerability in its ordered-map (omap) tag handling. When processing specially crafted YAML documents, the library performs redundant duplicate-key checks that consume excessive CPU resources, potentially causing denial-of-service conditions. The vulnerability affects versions 5.0.0 through 5.2.0 and is resolved in version 5.2.1.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 5.3 MEDIUM · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
- Weaknesses (CWE)
- CWE-407, CWE-770
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-07-08 / 2026-07-10
NVD description (verbatim)
js-yaml is a JavaScript YAML parser and dumper. From 5.0.0 before 5.2.1, YAML11_SCHEMA support for the !!omap tag in src/tag/sequence/omap.ts uses omapTag.addItem() to perform a linear duplicate-key scan on every insertion, causing O(n^2) CPU consumption when yaml.load() parses a crafted ordered-map document. This issue is fixed in version 5.2.1.
4 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The vulnerability exists in src/tag/sequence/omap.ts where the YAML11_SCHEMA implementation uses omapTag.addItem() to scan for duplicate keys during every insertion into an ordered map. This linear O(n²) algorithm becomes computationally expensive when processing YAML documents with large ordered-map structures. An attacker can craft a malicious YAML file with many omap entries that, when parsed via yaml.load(), forces the parser to perform redundant comparisons across all previously inserted items for each new insertion, exhausting CPU cycles.
Business impact
Applications relying on js-yaml to parse untrusted YAML input face denial-of-service risk. If user-supplied or external YAML documents are parsed without input validation or resource limits, an attacker can degrade application performance or render services unresponsive. This is particularly concerning for systems ingesting configuration files, API responses, or data pipelines where YAML is a common format. Organizations using js-yaml in production should prioritize understanding their exposure to untrusted YAML sources.
Affected systems
The nodeca js-yaml library versions 5.0.0 through 5.2.0 are affected. Any Node.js application or JavaScript environment (including Electron, Bundlers, and server-side runtimes) using an affected version of js-yaml in a context where yaml.load() processes untrusted or user-controlled YAML input is at risk.
Exploitability
Exploitability is straightforward: an attacker simply needs to provide a crafted YAML document with a large ordered-map structure to a system parsing it with a vulnerable version of js-yaml. No authentication, complex interaction, or special privileges are required. The attack vector is network-accessible, and the barrier to crafting a malicious YAML payload is low. However, real-world impact depends on the application's exposure to untrusted YAML input and any existing resource-limiting mechanisms.
Remediation
Update js-yaml to version 5.2.1 or later. Organizations should identify all dependencies on js-yaml across their codebase—both direct and transitive—and ensure updated versions are deployed. For development teams, this typically involves updating package.json and running dependency resolution tools (npm, yarn, pnpm) to pull in the patched version.
Patch guidance
Upgrade js-yaml to version 5.2.1 or above. Verify the upgrade by checking package.json, package-lock.json (or equivalent lock file), and confirming via npm list js-yaml that the installed version is 5.2.1 or later. For monorepos or complex dependency trees, use dependency scanning tools to confirm all transitive dependencies are updated. After patching, conduct a smoke test of YAML parsing functionality to ensure no regressions in your application.
Detection guidance
Review application logs and monitoring for signs of elevated CPU consumption correlating with YAML parsing operations. Check dependency manifests and lock files for js-yaml versions below 5.2.1. Use software composition analysis (SCA) tools to flag vulnerable versions in CI/CD pipelines. Monitor for unusual latency spikes when processing YAML inputs, which may indicate exploitation attempts. If you capture network traffic or log YAML payloads, look for omap tags with large numbers of entries.
Why prioritize this
This vulnerability warrants prompt but not emergency-level attention. The CVSS score of 5.3 (Medium) reflects limited availability impact with no confidentiality or integrity risk. However, denial-of-service vulnerabilities can disrupt service continuity, making patch deployment a high priority for systems accepting untrusted YAML. The fix is straightforward and low-risk, involving a minor version bump with no known breaking changes.
Risk score, explained
The CVSS 3.1 score of 5.3 reflects an attack vector that is network-accessible, requires no privileges or user interaction, and impacts only availability (not confidentiality or integrity). The Low (L) attack complexity indicates the exploit is straightforward to execute. The impact is rated as Low because the denial-of-service is resource exhaustion rather than complete system failure, and the vulnerability requires application-level exposure to untrusted YAML input.
Frequently asked questions
Does this vulnerability affect all js-yaml users?
No. The vulnerability only manifests when yaml.load() is called on untrusted or attacker-controlled YAML input. Applications that parse only trusted internal YAML configuration files are unlikely to be exploited. However, any system accepting YAML from users, APIs, or external sources should be considered at risk if running an affected version.
What is the difference between yaml.load() and yaml.dump() in the context of this vulnerability?
This vulnerability specifically affects yaml.load(), which parses YAML input. The yaml.dump() function serializes JavaScript objects to YAML and is not affected by this flaw. Applications using js-yaml only for serialization (dump) do not need to prioritize this patch.
Can existing resource limits or timeouts mitigate this vulnerability?
Partial mitigation is possible: implementing CPU timeouts, request timeouts, or parsing quotas can reduce the practical impact of this denial-of-service. However, these are defensive measures and should not substitute for patching. Upgrade to version 5.2.1 to eliminate the root cause.
Is this vulnerability actively exploited in the wild?
As of the published date, this vulnerability is not listed on CISA's Known Exploited Vulnerabilities catalog, indicating no widespread active exploitation has been reported. However, the straightforward nature of the exploit means organizations should not delay patching based on this status alone.
This analysis is provided for informational purposes and reflects the state of the vulnerability as of the published date. Patch versions and remediation steps are based on official vendor information; organizations should verify against the nodeca js-yaml repository and security advisories before deployment. No exploit code or proof-of-concept is provided. The absence of a CVE from CISA's Known Exploited Vulnerabilities list does not guarantee the vulnerability has not been exploited; it reflects only official reported cases. Risk prioritization should account for your specific application architecture, dependencies, and exposure to untrusted YAML input. Source: NVD (public-domain), retrieved 2026-08-17. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-59868MEDIUMjs-yaml Denial-of-Service via Merge Key Complexity
- CVE-2026-45664MEDIUMImageMagick MNG Coder Resource Limit Bypass (CVSS 5.3)
- CVE-2026-49851HIGHMistune Markdown Parser CPU Exhaustion DoS Vulnerability
- CVE-2026-53550MEDIUMjs-yaml Merge-Key CPU Exhaustion Denial of Service
- CVE-2026-59869HIGHjs-yaml Quadratic CPU Complexity DoS Vulnerability
- CVE-2024-54178MEDIUMIBM Db2 Cloud Pak for Data Denial of Service via Resource Allocation Flaw
- CVE-2025-36319MEDIUMIBM watsonx.data Intelligence DoS Vulnerability
- CVE-2026-10533MEDIUMOpenShift ResourceQuota Bypass Leads to API Server DoS