Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. js-yaml
  4. ›
  5. CVE-2026-59868

CVE-2026-59868: js-yaml: YAML merge-key chains can force quadratic CPU consumption in js-yaml

July 20, 2026

This is the same report as for v3/v4, but with lower severity, because in v5, merge is off by default

When merge keys (<<) are enabled, js-yaml can spend quadratic CPU time parsing a document whose size grows only linearly. The issue is triggered by a chain of mappings where each mapping merges the previous one:

a0: &a0 { k0: 0 }
a1: &a1 { <<: *a0, k1: 1 }
a2: &a2 { <<: *a1, k2: 2 }
a3: &a3 { <<: *a2, k3: 3 }
...
b: *aN

For each new mapping, the loader has to enumerate the keys inherited from the previous mapping. With N chained mappings, this results in roughly 1 + 2 + … + N merged-key visits, i.e., O(N^2) work for O(N) input size.

References

  • github.com/advisories/GHSA-g796-fgmg-93mv
  • github.com/nodeca/js-yaml/commit/3105455b81dee69e0fd36e09ac0b2ccfdb54adc1
  • github.com/nodeca/js-yaml/releases/tag/5.2.0
  • github.com/nodeca/js-yaml/security/advisories/GHSA-g796-fgmg-93mv
  • nvd.nist.gov/vuln/detail/CVE-2026-59868

Code Behaviors & Features

Detect and mitigate CVE-2026-59868 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 5.0.0 before 5.2.0

Fixed versions

  • 5.2.0

Solution

Upgrade to version 5.2.0 or above.

Impact 5.3 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Learn more about CVSS

Weakness

  • CWE-400: Uncontrolled Resource Consumption
  • CWE-407: Inefficient Algorithmic Complexity
  • CWE-770: Allocation of Resources Without Limits or Throttling

Source file

npm/js-yaml/CVE-2026-59868.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sat, 08 Aug 2026 00:19:20 +0000.