Vulnerabilities in pkg:npm/js-toml

PACKAGE
Advisory Identifier: GHSA-3g82-77xr-68x5
Advisory Summary

CVE-2026-63386 is a MODERATE (CVSS 5.3) js-toml allows uncontrolled recursion vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Js toml libraries in the npm ecosystem. The issue involves js-toml allows uncontrolled recursion in `load()` leading `rangeerror` (stack exhaustion) on deeply nested input. Remediation is available by upgrading affected packages to version 1.1.3.

4 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/js-toml

4 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/js-toml. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-3g82-77xr-68x5 CVE-2026-63386 MODERATE js-toml allows uncontrolled recursion in `load()` leading `RangeError` (stack exhaustion) on deeply nested input
GHSA-m34p-749j-x6m6 CVE-2026-50029 MODERATE js-toml has silent type confusion via falsy-primitive duplicate-key bypass
GHSA-wp3c-266w-4qfq CVE-2026-49293 HIGH js-toml vulnerable to CPU exhaustion via O(n^2) BigInt construction on radix-prefixed integer literals
GHSA-65fc-cr5f-v7r2 CVE-2025-54803 HIGH js-toml Prototype Pollution Vulnerability

CVE-2026-63386 at a Glance

CVE Identifier CVE-2026-63386
GHSA Identifier GHSA-3g82-77xr-68x5
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Js toml
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability Low (A:L)

How to Fix CVE-2026-63386

To remediate this vulnerability, upgrade all affected Js toml dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

js-toml fixed: 1.1.3
npm install js-toml@1.1.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls js-toml

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-63386, inspect your project dependencies using npm:

npm ls js-toml

Analyze the terminal output to locate any version of Js toml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.1.3), your application is affected.

Note: The npm ls js-toml command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Js toml, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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.

CVE-2026-63386 Affected Js toml Versions

1 component(s)
Fixed Versions:
1.1.3
Product / Package Ecosystem Affected Versions Fixed Version
js-toml
npm
< 1.1.3
1.1.3

References

Frequently Asked Questions

What is CVE-2026-63386?
CVE-2026-63386 is a security vulnerability in Js toml involving js-toml allows uncontrolled recursion in `load()` leading `RangeError` (stack exhaustion) on deeply nested input under CWE-400: Uncontrolled Resource Consumption.
Which Js toml versions are affected?
Affected versions include releases prior to 1.1.3 across affected packages: js-toml.
What version fixes CVE-2026-63386?
Upgrading to 1.1.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is js-toml affected?
Yes, js-toml is affected in releases prior to 1.1.3. Upgrade your dependency to 1.1.3 or later.
What is the CVSS score of CVE-2026-63386?
CVE-2026-63386 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2026-63386?
CVE-2026-63386 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check npm dependencies for CVE-2026-63386?
Run the dependency tree command: 'npm ls js-toml'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-3g82-77xr-68x5",
  "modified" : "2026-11-20T14:40:45Z",
  "published" : "2026-11-20T14:40:45Z",
  "aliases" : [ "CVE-2026-63386" ],
  "summary" : "js-toml allows uncontrolled recursion in `load()` leading `RangeError` (stack exhaustion) on deeply nested input",
  "details" : "## Summary\n\n`load()` parses untrusted TOML using a recursive-descent parser (Chevrotain) and a\nrecursive tree-walking interpreter. Neither the parser nor the interpreter enforces a\nmaximum nesting / key depth. A small, attacker-controlled document with deep nesting\n(arrays, inline tables) or a long dotted key drives recursion past the V8 call-stack\nlimit, and `load()` throws an **uncaught `RangeError: Maximum call stack size exceeded`**.\n\nThis is a problem for two reasons:\n\n1. **Denial of Service.** A tiny payload (≈2 KB) reliably aborts parsing. In any\n   service that parses user-supplied TOML, an unhandled `RangeError` can crash the\n   worker/process (500 / restart loop).\n2. **Error-contract violation.** The library signals invalid input via\n   `SyntaxParseError` (see `src/load/exception.ts`; the entire test suite asserts\n   `SyntaxParseError`). Consumers that follow this contract —\n\n   ```js\n   try { load(input); }\n   catch (e) {\n     if (e instanceof SyntaxParseError) return badRequest();\n     throw e; // unexpected -> propagates\n   }\n   ```\n\n   — will **re-throw** the `RangeError` instead of treating the input as malformed,\n   turning malformed input into an unexpected fatal error.\n\n## Impact\n\n- Unauthenticated attacker who can supply a TOML string to an application using\n  `js-toml` can force `load()` to throw a non-`SyntaxParseError` error.\n- If the error is not caught by a generic handler, the Node.js process terminates\n  (availability impact).\n- Even when caught generically, the documented/expected error type contract is broken,\n  which can bypass input-validation branches that key off `SyntaxParseError`.\n\nNo confidentiality or integrity impact. The error is thrown synchronously and is\ncatchable, so a consumer that catches *all* exceptions is not crashed — this is why the\nseverity is assessed Low–Medium rather than High.\n\n## Affected code / root cause\n\nThere is no depth bound anywhere in the parse pipeline. Recursion occurs in (at least)\ntwo independent places:\n\n1. **Parser (recursive descent).** `src/load/parser.ts` — `array` / `inlineTable`\n   rules recurse through `value` for each nesting level.\n2. **Interpreter (tree walk).** `src/load/interpreter.ts` —\n   `assignValue`, `createTable`, `getOrCreateArray` recurse per dotted-key segment, and\n   `cleanInternalProperties` recurses per object depth.\n\nBecause there is no configurable or hard limit, the recursion depth is bounded only by\nthe V8 stack, and overflow surfaces as a raw `RangeError`.\n\n## Steps to reproduce (PoC)\n\nEnvironment used: Node.js v20, `js-toml@1.1.2`.\n\n```js\nimport { load, SyntaxParseError } from 'js-toml';\n\nfunction probe(label, toml) {\n  try {\n    load(toml);\n    console.log(`[OK]            ${label}`);\n  } catch (e) {\n    const expected = e instanceof SyntaxParseError;\n    console.log(`[${e.constructor.name}${expected ? '' : ' (UNEXPECTED)'}] ${label}: ${String(e.message).split('\\n')[0]}`);\n  }\n}\n\n// 1) Deeply nested arrays  (~2 KB payload)\nprobe('nested array depth 1000', 'x = ' + '['.repeat(1000) + ']'.repeat(1000));\n\n// 2) Deeply nested inline tables\nlet v = '1';\nfor (let i = 0; i < 1000; i++) v = `{ a = ${v} }`;\nprobe('nested inline table depth 1000', 'x = ' + v);\n\n// 3) Deep dotted key (interpreter recursion)\nconst key = Array.from({ length: 5000 }, (_, i) => 'a' + i).join('.');\nprobe('dotted key depth 5000', `${key} = 1`);\n```\n\n### Observed output\n\n```\n[RangeError (UNEXPECTED)] nested array depth 1000: Maximum call stack size exceeded\n[RangeError (UNEXPECTED)] nested inline table depth 1000: Maximum call stack size exceeded\n[RangeError (UNEXPECTED)] dotted key depth 5000: Maximum call stack size exceeded\n```\n\nEach case throws `RangeError`, **not** `SyntaxParseError`. Overflow occurs in single-digit\nmilliseconds, so it is not a CPU-exhaustion issue — it is an immediate, deterministic abort.\n\nNotes on thresholds (machine-dependent; exact numbers vary by stack size):\n- Nested arrays / inline tables overflow at roughly **depth ~1000** (parser recursion).\n- Dotted keys overflow at roughly **depth ~5000** (interpreter recursion); depth 1000 still succeeds.\n\n## Suggested remediation\n\nEnforce an explicit, documented maximum nesting/key depth and surface violations as\n`SyntaxParseError` (consistent with all other invalid-input handling). For example:\n\n- Track current depth in the parser/interpreter and throw `SyntaxParseError`\n  (e.g. `\"Maximum nesting depth exceeded\"`) once a configurable limit (e.g. 100–1000)\n  is reached, **before** the native stack overflows.\n- As a defensive backstop, wrap the top-level `load()` body so that a thrown\n  `RangeError` from stack exhaustion is converted into a `SyntaxParseError`, guaranteeing\n  the documented error contract holds for all malformed input.\n\nA configurable limit (with a safe default) is preferable so legitimate deep documents can\nopt into a higher bound.\n\n## Disclosure\n\nReported privately via GitHub Security Advisory. Happy to provide additional reproducers\nor test against a candidate patch.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "js-toml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.1.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/sunnyadn/js-toml/security/advisories/GHSA-3g82-77xr-68x5"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-63386"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sunnyadn/js-toml/commit/4e10acf1f99ff3cb443c58b8f0a57664e41e87c6"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/sunnyadn/js-toml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sunnyadn/js-toml/releases/tag/v1.1.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-674" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-20T14:40:45Z",
    "nvd_published_at" : "2026-09-22T19:16:44Z"
  }
}