# js-yaml CPU exhaustion via merge keys with empty mappings

Source: https://junglewise.ai/threats/js-yaml-maxtotalmergekeys-does-not-limit-cpu-use-for-empty-merge-e18172a3  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-09-29. Updated: 2026-09-29  
License: CC BY 4.0 with a link back

Severity: medium · CVSS 5.3 · Published 2026-09-29

js-yaml is a YAML parser library used by Node.js applications to process YAML configuration files and data. An attacker can craft a small YAML document that causes the parser to consume excessive CPU time despite configured limits, potentially disrupting services that parse untrusted YAML input. The vulnerability bypasses the maxTotalMergeKeys resource limit by exploiting empty merge sources, allowing denial-of-service attacks without meaningful file size restrictions.

Technologies: [Nodeca Js-Yaml](https://junglewise.ai/threats/technologies/nodeca-js-yaml), [js-yaml (npm)](https://junglewise.ai/threats/technologies/js-yaml). Vendors: [Nodeca](https://junglewise.ai/threats/vendors/nodeca), [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Medium severity, with a CVSS score of 5.3, published 29 September 2026.

**Which products and versions are affected?** Nodeca Js-Yaml 5.0.0 to 5.4.0; js-yaml (npm) >= 5.0.0, <= 5.4.0.

**Is there a fix for This vulnerability?** A patch was published on 2026-09-29: Version 5.4.1 released with fix Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked over the network.

**Am I affected?** Check whether you run Nodeca Js-Yaml or js-yaml (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

The vulnerability is an inefficient algorithmic complexity flaw in YAML merge key processing. When maxTotalMergeKeys limits are enabled, the parser does not count empty mappings in merge sources, allowing attackers to trigger O(N*K) iteration work where N is the number of empty objects and K is the number of merge operations. The flaw affects versions 5.0.0 through 5.4.0 when processing YAML with merge keys enabled; no authentication or user interaction is required—only network submission of a crafted YAML document.

## Affected products

- nodeca js-yaml 5.0.0 to 5.4.0

## Timeline

- 2026-08-26: disclosed: GitHub Advisory published
- 2026-09-29: patched: Version 5.4.1 released with fix

## References

- [https://github.com/nodeca/js-yaml/security/advisories/GHSA-r3ph-w7gj-g6xm](https://github.com/nodeca/js-yaml/security/advisories/GHSA-r3ph-w7gj-g6xm)

## Related threats

- [js-yaml YAML merge CPU consumption DoS](https://junglewise.ai/threats/cve-2026-84375-js-yaml-denial-of-service-via-empty-merge-sources)
- [js-yaml exponential parsing time in flow collections denial of service](https://junglewise.ai/threats/cve-2026-73643-js-yaml-exponential-parsing-time-in-flow-collections-denial-of)
- [JS-YAML quadratic CPU consumption in !!omap resolution](https://junglewise.ai/threats/js-yaml-quadratic-cpu-consumption-in-omap-resolution-f21ac1bd)
- [nodeca js-yaml denial of service in YAML11_SCHEMA omap parsing](https://junglewise.ai/threats/cve-2026-59870-nodeca-js-yaml-denial-of-service-in-yaml11-schema-omap-parsing)
- [nodeca js-yaml denial of service via merge key chains](https://junglewise.ai/threats/cve-2026-59869-nodeca-js-yaml-denial-of-service-via-merge-key-chains)
