nodeca js-yaml Denial of Service via complex map keys

Severity: low · CVSS 3.1 · Published 2019-06-05

The js-yaml library, a popular tool for parsing YAML data in Node.js applications, is vulnerable to a denial-of-service attack. An attacker can provide a specially crafted YAML file that causes the application to consume excessive system resources or stop responding. This can lead to service outages and prevent legitimate users from accessing the application.

Technologies: js-yaml (npm). 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?
Low severity, with a CVSS score of 3.1, published 5 June 2019.
Which products and versions are affected?
js-yaml (npm) SEMVER:introduced=0,fixed=3.13.0.
Is there a fix for This vulnerability?
Yes. js-yaml (npm): upgrade to 3.13.0 or later. 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, in a software library.
Am I affected?
Check whether you run 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.

How to fix

  • js-yaml (npm): upgrade to 3.13.0 or later
    npm install js-yaml@3.13.0

Technical details

Versions of js-yaml prior to 3.13.0 are vulnerable to a Denial of Service (DoS) via resource exhaustion. The vulnerability occurs when the parser processes complex arrays used as map keys. By utilizing YAML aliases and anchors to create deeply nested structures, an attacker can cause the output string representation of a key to grow exponentially relative to a linear input (similar to a 'Billion Laughs' attack). This results in the Node.js process stalling or exhausting memory. The issue was addressed by restricting the data types allowed for object keys in the `storeMappingPair` function.

Affected products

  • nodeca js-yaml < 3.13.0

Timeline

  • 2019-03-18: disclosed: Vulnerability disclosed by researchers
  • 2019-03-20: patched: Fix committed to repository
  • 2019-06-05: advisory: GitHub advisory published

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.