GHSA-PM4M-PH32-GHV5

GHSA-PM4M-PH32-GHV5 is a high-severity security vulnerability in js-yaml (npm), affecting versions >= 5.0.0, <= 5.2.1. It is fixed in 5.2.2.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

js-yaml: Exponential parsing time in flow collections leads to denial of service

Parsing a small YAML document can take exponential time. An application that calls load() or loadAll() on untrusted input can be hung by a payload under 200 bytes.

Details

When an entry in a flow sequence turns out to be a key: value pair, the parser rewinds and parses that entry a second time as the key.
If the key is itself a nested flow sequence of the same shape, every level is parsed twice, so the total work is O(2^n) in the nesting depth. The default maxDepth of 100 does not help, because the time is already unmanageable at about 30 to 40 levels.

Root cause, potentially the: readFlowCollection in parser.ts, the restoreState followed by a second parseNode further down.

PoC

const yaml = require('js-yaml')
const n = 30
yaml.load('[ '.repeat(n) + '1' + ' ]: 0'.repeat(n))

With default options: 22 levels takes about 1 second, 26 levels about 17 seconds, 30 levels over 2 minutes. The input stays under 200 bytes and grows linearly with n.

Impact

Denial of service. A single small request can keep one CPU busy for minutes or longer and blocks the Node event loop, so one request can stall the whole process. No anchors, aliases, merges, tags, or non default options are required, and it reproduces on the default schema.

GHSA-PM4M-PH32-GHV5 has a CVSS score of 7.5 (High). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (5.2.2); upgrading removes the vulnerable code path.

Affected versions

js-yaml (>= 5.0.0, <= 5.2.1)

Security releases

js-yaml → 5.2.2 (npm)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Upgrade js-yaml to 5.2.2 or later to resolve this vulnerability.

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is GHSA-PM4M-PH32-GHV5? GHSA-PM4M-PH32-GHV5 is a high-severity security vulnerability in js-yaml (npm), affecting versions >= 5.0.0, <= 5.2.1. It is fixed in 5.2.2.
  2. How severe is GHSA-PM4M-PH32-GHV5? GHSA-PM4M-PH32-GHV5 has a CVSS score of 7.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of js-yaml are affected by GHSA-PM4M-PH32-GHV5? js-yaml (npm) versions >= 5.0.0, <= 5.2.1 is affected.
  4. Is there a fix for GHSA-PM4M-PH32-GHV5? Yes. GHSA-PM4M-PH32-GHV5 is fixed in 5.2.2. Upgrade to this version or later.
  5. Is GHSA-PM4M-PH32-GHV5 exploitable, and should I be worried? Whether GHSA-PM4M-PH32-GHV5 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether GHSA-PM4M-PH32-GHV5 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix GHSA-PM4M-PH32-GHV5? Upgrade js-yaml to 5.2.2 or later.

Other vulnerabilities in js-yaml

Stop the waste.
Protect your environment with Kodem.