load() parses untrusted TOML using a recursive-descent parser (Chevrotain) and a
recursive tree-walking interpreter. Neither the parser nor the interpreter enforces a
maximum nesting / key depth. A small, attacker-controlled document with deep nesting
(arrays, inline tables) or a long dotted key drives recursion past the V8 call-stack
limit, and load() throws an uncaught RangeError: Maximum call stack size exceeded.
This is a problem for two reasons:
Denial of Service. A tiny payload (≈2 KB) reliably aborts parsing. In any
service that parses user-supplied TOML, an unhandled RangeError can crash the
worker/process (500 / restart loop).
Error-contract violation. The library signals invalid input via
SyntaxParseError (see src/load/exception.ts; the entire test suite asserts
SyntaxParseError). Consumers that follow this contract —
try { load(input); }
catch (e) {
if (e instanceof SyntaxParseError) return badRequest();
throw e; // unexpected -> propagates
}
— will re-throw the RangeError instead of treating the input as malformed,
turning malformed input into an unexpected fatal error.
js-toml can force load() to throw a non-SyntaxParseError error.SyntaxParseError.No confidentiality or integrity impact. The error is thrown synchronously and is catchable, so a consumer that catches all exceptions is not crashed — this is why the severity is assessed Low–Medium rather than High.
There is no depth bound anywhere in the parse pipeline. Recursion occurs in (at least) two independent...
1.1.3Exploitability
AV:NAC:LPR:NUI:NScope
S:UImpact
C:NI:NA:L5.3/CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:LOther
Resource Management