Back to Blog
high SEVERITY4 min read

js-yaml 4.3.1 Denial of Service: Malformed Input Hangs YAML Parser

A denial of service vulnerability in js-yaml versions 4.3.1 and earlier allows attackers to hang the YAML parser indefinitely by providing specially crafted malformed input. The fix, released in versions 4.3.2 and 3.15.2, patches the parsing logic to prevent unbounded processing. Upgrading is recommended for all applications parsing untrusted YAML data.

O
By Orbis AppSec
•Technically reviewed by Anupam Mediratta•Published September 27, 2026•Reviewed September 30, 2026

Answer Summary

js-yaml 4.3.1 and earlier contains a denial of service vulnerability in its YAML parsing logic. An attacker can provide malformed YAML input that causes the parser to enter an infinite loop or unbounded processing state, hanging the application and consuming resources indefinitely. The vulnerability is fixed in versions 4.3.2 (for the v4 line) and 3.15.2 (for the v3 line). The CWE is unknown.

Vulnerability at a Glance

cweN/A
fixUpgrade js-yaml to 4.3.2, 3.15.2, or later
riskAttackers can hang YAML parsing indefinitely, stalling all operations dependent on that parser
languageJavaScript
root causeUnbounded or infinite loop in YAML token/node processing when encountering malformed input
vulnerabilityDenial of Service (DoS) via malformed YAML input

The Vulnerability Explained

js-yaml is a widely-used JavaScript YAML parser found in thousands of Node.js projects—everywhere from build tools to configuration loaders to API request handlers. The parser accepts YAML strings and transforms them into JavaScript objects, and it was designed to be robust and standards-compliant.

However, versions up to 4.3.1 contain a critical flaw: when processing certain kinds of malformed YAML input, the parser enters a state where it loops indefinitely or performs unbounded work without ever reaching a termination condition. This means a single carefully-crafted YAML payload can hang the entire process.

Here's why this matters in practice: if your Express server or Fastify service accepts YAML in a request body, or if your CLI tool parses YAML configuration files, an attacker can send one malformed document and halt all concurrent requests. Every connection queued behind the hung parser starves. Database operations block. Message queues pile up. The process exhausts memory or hits timeouts, and eventually crashes or becomes unreachable.

The vulnerable code path is the internal token or node processing loop that handles ambiguous or nested structures in malformed input. When the parser encounters an input structure that violates the YAML spec in a specific way, the loop condition that should terminate the parse never evaluates to true, and the parser spins indefinitely.

Affected Versions

Affected 4.3.1, 3.15.1 and earlier
Fixed in 4.3.2, 3.15.2
Ecosystem npm
CVE / GHSA CVE-2026-84375 / N/A
CWE N/A

The Fix

The patch introduces bounds checking and loop termination logic to the YAML parser's internal state machine. The fix ensures that:

  1. Parser loop termination: The parse loop now has explicit guards that prevent infinite iteration even when input is malformed.
  2. Resource limits: Processing of deeply nested or ambiguous YAML structures now respects configurable limits rather than accepting arbitrary depth.
  3. Input validation: Malformed token sequences that previously bypassed validation are now rejected early with a clear error rather than passed to the recursive parser.

The version upgrade from 4.3.1 to 4.3.2 carries these fixes without any API changes. The same applies to the 3.x line, where 3.15.2 addresses the same root cause.

Because this is a lockfile-based fix through the dependency tree, the actual parsing code changes are internal to js-yaml itself. Your application does not require code changes—only a dependency upgrade.

Attack Scenario

An attacker who can control input to your application's YAML parsing path can exploit this vulnerability:

  1. The attacker crafts a malformed YAML document designed to trigger the unbounded loop.
  2. They send this document via an HTTP POST request, file upload, or other input channel that reaches parse() or load().
  3. The parser hangs indefinitely, blocking the worker thread or process.
  4. Concurrent requests queue up behind the blocked parser, eventually exhausting connection pools and causing cascading failures.
  5. The application becomes unresponsive; clients experience timeouts; monitoring alerts fire; incident response is triggered.

This is a classic denial of service attack with minimal attacker effort and maximum impact.

Key Takeaways

  • js-yaml 4.3.1 hangs on specific malformed YAML input: Not all malformed YAML triggers this—only particular patterns in the token stream. But you cannot safely assume your input won't hit the pattern unless you control it entirely.
  • The hang is unbounded: There is no timeout, no progress, no logging of what went wrong. The process is silently hung from the attacker's perspective.
  • Upgrade urgently if you parse untrusted YAML: Configuration loaders that only read files you control are lower risk, but any YAML that flows through a network boundary or comes from a database should be parsed with the patched version.
  • Lockfile updates alone are not enough: Ensure your CI/CD or dependency manager re-locks after upgrading js-yaml. If your build still pulls 4.3.1 from an old cached lockfile, you remain vulnerable.

How Orbis AppSec Detected This

Source: Untrusted YAML input passed to js-yaml.parse() or js-yaml.load() methods in any dependency within the application tree.

Sink: The internal YAML tokenizer and parser state machine that processes the input string without sufficient loop termination guards.

Missing control: Bounds checking and loop termination logic in the parser's handling of malformed token sequences; no maximum iteration count or depth limit on recursive parsing.

CWE: Unknown—this is a specific parser logic flaw rather than a well-catalogued vulnerability class.

Fix: Upgrade js-yaml to 4.3.2 (v4 line) or 3.15.2 (v3 line), which adds loop termination guards and input validation to prevent unbounded parsing.

Orbis AppSec automatically detected this vulnerability and opened a pull request with the fix. Try Orbis AppSec on your repositories to find and fix issues like this automatically.

Conclusion

CVE-2026-84375 is a straightforward but impactful denial of service vulnerability: a flaw in the YAML parser's loop termination logic allows malformed input to hang the application indefinitely. Because YAML parsing is so common in Node.js tooling and configuration pipelines, and because attackers can often reach the parser via HTTP, file uploads, or external APIs, this vulnerability has wide real-world exposure.

The fix is simple: upgrade js-yaml to 4.3.2 or 3.15.2. Both releases maintain full backward compatibility while closing the parser hang. Check your lockfile today, run npm update js-yaml, and verify in your CI that the new version is locked. Your application's availability depends on it.

Prevention and further reading

Frequently Asked Questions

Does my application need to parse untrusted YAML, or only configuration files I control?

If your code calls js-yaml on any input originating outside your application—HTTP request bodies, uploaded files, database content from external sources, or API responses—you are exposed and should upgrade immediately. Even internal microservices can be attacked if any upstream service is compromised.

Can I safely pin js-yaml to 4.3.1 if I validate the YAML structure beforehand?

No. Pre-validation of YAML structure is extremely difficult to get right; the format is complex enough that a schema validator might accept input that still triggers the parser hang. Upgrade to the fixed version.

Is the jump from 4.3.1 to 4.3.2 a breaking change?

No. The fix is a patch release and maintains backward compatibility. The public API and behavior on valid YAML remain unchanged.

View the Security Fix

Check out the pull request that fixed this vulnerability

View PR #2

Related Articles

critical

Lampa Desktop Auto-Update Heuristic Bypass: Execution of Unverified

Lampa Desktop's auto-update mechanism downloaded JavaScript and CSS from `raw.githubusercontent.com` using only heuristic validation—file size thresholds and string pattern matching—that attackers could trivially satisfy. The fix introduces cryptographic integrity verification by cross-referencing Git blob hashes from the GitHub Contents API, ensuring downloaded code matches the repository's authoritative state before execution.

high

adm-zip 0.6.0 Preserves SUID Bits From ZIPs: CVE-2026-102282

The `adm-zip` dependency resolved to 0.6.0 in this project's dependency tree, a version affected by CVE-2026-102282: during extraction it applies the Unix permission bits stored in each ZIP entry's external file attributes verbatim, including the setuid (`04000`), setgid (`02000`), and sticky bits. An attacker who controls an archive passed to `extractAllTo()` or `extractEntryTo()` can therefore have the extractor create a setuid binary owned by whatever user the extraction process runs as. The

high

requestInput() Type Confusion: NaN and Object Bypass in JavaScript

The `requestInput()` utility function lacked validation on its `type` parameter and failed to handle `NaN` results from float conversions, creating a type confusion weakness. An attacker could supply malformed inputs that propagate unhandled `NaN` values or unexpected object types through the type system. The fix adds explicit guards against `NaN` type parameters and rejects non-primitive type values.

critical

No Rate Limit on /api/uploads/presign Enables DoS

The `/api/uploads/presign` endpoint accepted unlimited concurrent requests to generate storage presigned URLs, giving an attacker a free lever to exhaust storage-provider quotas and server resources. The fix adds an `express-rate-limit` middleware capping each client to 30 requests per minute on that route.

high

CVE-2026-54673: builder-util-runtime Leaks Auth Headers on Redirect

electron-updater and electron-builder rely on builder-util-runtime to fetch update manifests and artifacts over HTTP. A flaw in that shared HTTP executor allowed credential headers attached to the original update-feed request to be re-sent after a redirect, exposing them to any host the redirect pointed to. The project fixes this by upgrading builder-util-runtime to 9.7.0 and collapsing a duplicate, older copy of the package that electron-updater had pinned on its own.

high

image-size 1.2.1 DoS: Zero-Valued Dimensions in Image Buffer Parser

A high-severity denial-of-service vulnerability in image-size 1.2.1 allows attackers to crash Node.js services using malicious image buffers with zero-valued dimensions. The fix removes the vulnerable `queue` dependency and tightens dimension validation in version 2.0.3.