JS-YAML: Quadratic CPU consumption
Affects js-yamlSource GCVE Database
Mentioned vulnerabilities
CVSS 7.5 High : upgrade to 4.3.1 soon.
Data as of 7 Aug 2026, 06:11 UTC
- Patch
- Available – fixed in 4.3.1, 3.15.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HWhat to do
Upgrade js-yaml to 4.3.1; js-yaml to 3.15.1.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| npmjs-yaml | Affected
| Fixed in
|
| npmjs-yaml | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
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.
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.