highCVSS 7.5Vulnerability

GHSA-pm4m-ph32-ghv5

### Summary 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](https://github.com/nodeca/js-yaml/blob/master/src/parser/parser.ts), the `restoreState` followed by a second `parseNode` further down. ### PoC ```javascript 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.

Properties

ghsa_id
GHSA-pm4m-ph32-ghv5
summary
js-yaml: Exponential parsing time in flow collections leads to denial of service
severity
high
cvss_score
7.5
cve_id
GHSA-pm4m-ph32-ghv5
cvss_vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
is_ghsa_only
true
ghsa_published
2026-07-24T16:47:36Z
source_url
https://github.com/advisories/GHSA-pm4m-ph32-ghv5
ghsa_updated
2026-07-24T16:47:37Z

Related Entities (4)

REPORTED_BY (1)

[Source]GitHub Advisory Database

VULNERABLE_TO (1)

[Software]npm/js-yaml

AFFECTS (1)

[Software]npm/js-yaml

HAS_WEAKNESS (1)

[Weakness]Inefficient Algorithmic Complexity

Explore deeper with Ninja Signal's threat intelligence graph