Track vulnerabilities like this one.
Sign up free to get alerted when software you use is affected.
7.5
js-yaml: Denial of Service through Exponential Parsing
published 2 months ago
Summary
A malicious YAML document can cause js-yaml to take an excessive amount of time to parse, potentially freezing an application or server. This is a concern for applications that accept untrusted YAML input, as a single malicious request can cause significant delays. To mitigate this, consider using a library that is not affected by this issue or implementing additional validation and security measures.
What to do
- Update vitaly js-yaml to version 5.2.2.
Affected software
| Ecosystem | Vendor | Product | Affected versions |
|---|---|---|---|
| npm | vitaly | js-yaml |
>= 5.0.0, < 5.2.2 Fix: upgrade to 5.2.2
|
| – | nodeca | js-yaml | >= 5.0.0, < 5.2.2 |
Original advisory text
js-yaml: Exponential parsing time in the flow collections leads to denial of service
js-yaml is a JavaScript YAML parser and dumper. From 5.0.0 until 5.2.2, parsing a small YAML document can take exponential time when an application calls load() or loadAll() on untrusted input. In src/parser/parser.ts, readFlowCollection uses restoreState and calls parseNode a second time when a flow-sequence entry is recognized as a key: value pair. If the key is a nested flow sequence of the same shape, every level is parsed twice, causing O(2^n) work and allowing an input under 200 bytes to keep one CPU busy for minutes, block the Node.js event loop, and stall the process. No anchors, aliases, merges, tags, or nondefault options are required. This issue is fixed in version 5.2.2.
Internet-facing
14 days
Internal
60 days
- Not known to be exploited
- Can be exploited automatically (estimated)
- Gives an attacker partial control (estimated)
Type
CWE-407Inefficient Algorithmic Complexity
Timeline
Published13 Aug 2026
Updated15 Aug 2026
First seen28 Jul 2026
Sources
GHSA-pm4m-ph32-ghv5 · OSV
Track software like this
Free during beta