Skip to content
FlawDB
Sign in

CVE-2026-63386

MEDIUM 5.3EPSS 36%

js-toml allows uncontrolled recursion in `load()` leading `RangeError` (stack exhaustion) on deeply nested input

Also known as GHSA-3g82-77xr-68x5

Mitigation

  • Upgrade js-toml to 1.1.3 or later.

Who should check

  • Projects that depend on npm package js-toml (< 1.1.3)

Vulnerability facts

Affected
js-toml < 1.1.3
Fixed in
1.1.3
Exploited in the wild
Not in CISA KEV
Public exploit / PoC
None known
Remote exploitation
Remote, no login needed
CVSS
5.3 (v3.1, GitHub)CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:LOpen in CVSS calculator
Show all 8 CVSS metrics
  • Attack vector: Network
  • Attack complexity: Low
  • Privileges required: None
  • User interaction: None
  • Scope: Unchanged
  • Confidentiality impact: None
  • Integrity impact: None
  • Availability impact: Low
EPSS
0.51% chance of exploitation in 30 days (percentile 36, 2026-11-26)
CWE
CWE-400, CWE-674
Published
Modified

Description

## Summary `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: 1. **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). 2. **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 — ```js 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. ## Impact - Unauthenticated attacker who can supply a TOML string to an application using `js-toml` can force `load()` to throw a non-`SyntaxParseError` error. - If the error is not caught by a generic handler, the Node.js process terminates (availability impact). - Even when caught generically, the documented/expected error type contract is broken, which can bypass input-validation branches that key off `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. ## Affected code / root cause There is no depth bound anywhere in the parse pipeline. Recursion occurs in (at least) two independent places: 1. **Parser (recursive descent).** `src/load/parser.ts` — `array` / `inlineTable` rules recurse through `value` for each nesting level. 2. **Interpreter (tree walk).** `src/load/interpreter.ts` — `assignValue`, `createTable`, `getOrCreateArray` recurse per dotted-key segment, and `cleanInternalProperties` recurses per object depth. Because there is no configurable or hard limit, the recursion depth is bounded only by the V8 stack, and overflow surfaces as a raw `RangeError`. ## Steps to reproduce (PoC) Environment used: Node.js v20, `js-toml@1.1.2`. ```js import { load, SyntaxParseError } from 'js-toml'; function probe(label, toml) { try { load(toml); console.log(`[OK] ${label}`); } catch (e) { const expected = e instanceof SyntaxParseError; console.log(`[${e.constructor.name}${expected ? '' : ' (UNEXPECTED)'}] ${label}: ${String(e.message).split('\n')[0]}`); } } // 1) Deeply nested arrays (~2 KB payload) probe('nested array depth 1000', 'x = ' + '['.repeat(1000) + ']'.repeat(1000)); // 2) Deeply nested inline tables let v = '1'; for (let i = 0; i < 1000; i++) v = `{ a = ${v} }`; probe('nested inline table depth 1000', 'x = ' + v); // 3) Deep dotted key (interpreter recursion) const key = Array.from({ length: 5000 }, (_, i) => 'a' + i).join('.'); probe('dotted key depth 5000', `${key} = 1`); ``` ### Observed output ``` [RangeError (UNEXPECTED)] nested array depth 1000: Maximum call stack size exceeded [RangeError (UNEXPECTED)] nested inline table depth 1000: Maximum call stack size exceeded [RangeError (UNEXPECTED)] dotted key depth 5000: Maximum call stack size exceeded ``` Each case throws `RangeError`, **not** `SyntaxParseError`. Overflow occurs in single-digit milliseconds, so it is not a CPU-exhaustion issue — it is an immediate, deterministic abort. Notes on thresholds (machine-dependent; exact numbers vary by stack size): - Nested arrays / inline tables overflow at roughly **depth ~1000** (parser recursion). - Dotted keys overflow at roughly **depth ~5000** (interpreter recursion); depth 1000 still succeeds. ## Suggested remediation Enforce an explicit, documented maximum nesting/key depth and surface violations as `SyntaxParseError` (consistent with all other invalid-input handling). For example: - Track current depth in the parser/interpreter and throw `SyntaxParseError` (e.g. `"Maximum nesting depth exceeded"`) once a configurable limit (e.g. 100–1000) is reached, **before** the native stack overflows. - As a defensive backstop, wrap the top-level `load()` body so that a thrown `RangeError` from stack exhaustion is converted into a `SyntaxParseError`, guaranteeing the documented error contract holds for all malformed input. A configurable limit (with a safe default) is preferable so legitimate deep documents can opt into a higher bound. ## Disclosure Reported privately via GitHub Security Advisory. Happy to provide additional reproducers or test against a candidate patch.

Affected and fixed versions

Package / productAffectedFixedSource
npm js-toml< 1.1.31.1.3ghsa

Check your systems with an agent

Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.

Check whether anything I run is affected by CVE-2026-63386. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-63386.md
Affected: js-toml < 1.1.3
Fixed in: 1.1.3

Steps:
1. Search this machine and project for js-toml (npm): dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.

Technologies

References

FAQ

Is CVE-2026-63386 being exploited?

There is no confirmed exploitation: CVE-2026-63386 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.51% chance of exploitation in the next 30 days (as of 2026-11-26).

How serious is CVE-2026-63386?

Medium: CVSS 5.3 (v3.1, scored by GitHub). Remote, no login needed.

Which versions are affected by CVE-2026-63386?

js-toml < 1.1.3.

Is there a fix for CVE-2026-63386?

Yes. Fixed in 1.1.3. Upgrade js-toml to 1.1.3 or later.

How do I check if I'm affected by CVE-2026-63386?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

Sponsors