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

GHSA-J4CP-CC36-JXWG

Exponential backtracking in the multi-line basic string grammar lets a ~100-byte document hang the event loop

Parche disponible
Descargar PNG JSON
CVSS 3.1
7.5
Alta
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche el mismo día de la divulgación
Exposición109 dDesde la divulgación, 3 ago 2026, 11:36 p. m.
Detección108 dDesde 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 vector CVSS 3.1 y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, automatizable e impacto técnico parcial. Hay versiones corregidas disponibles.
Esto amerita una regla de detección, por si acaso.Esto huele a PoC esperando su momento.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Parche 1.2.2
Monitoreo
Detectada +1
4 ago 26
20 nov 26
21 nov 26
4 ago 26
31 ago 26
27 sept 26
25 oct 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-J4CP-CC36-JXWG divulgada · CVSS 7.5 (GitHub)
Remediación Parche 1.2.2 js-toml · 0 d desde divulgación
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

An unterminated multi-line basic string containing a run of line-ending backslashes makes `load()` backtrack exponentially. Under 100 bytes of input blocks the event loop for about nine seconds, and each further three bytes doubles that.

Details

`multiLineBasicEscapedNewline` in `src/load/tokens/MultiLineBasicString.ts` was:

{{escape}}{{whiteSpace}}{{newline}}({{whiteSpaceChar}}|{{newline}})*

The trailing `({{whiteSpaceChar}}|{{newline}})*` is ambiguous with the enclosing `{{multiLineBasicContent}}*` loop, which matches the same characters: `{{newline}}` directly, and spaces and tabs through `basicUnescaped`. Every whitespace character following the escaped newline can be consumed at either level.

While a match succeeds this costs nothing. When the overall match must fail, which is what an unterminated string forces, the engine enumerates every composition of the whitespace run before giving up.

Impact

Any application calling `load()` on TOML it did not author. In practice that means services accepting TOML uploads, and build or CI systems parsing TOML out of untrusted repositories. An application reading its own configuration file from disk is not exposed.

Measured on Node v22.22.3, payload `x = """` followed by `\<newline><space>` repeated n times:

 67 B     45 ms
 79 B    128 ms
 85 B    508 ms
 91 B   2105 ms
 97 B   8631 ms

Cost doubles roughly every three bytes added. Extrapolating, about 133 bytes reaches ten hours and about 163 bytes exceeds a year. The hang is a busy loop inside the lexer, so it is not interruptible and the process must be killed.

The distinguishing property is that damage is unbounded at trivial input size. A request-size limit, which caps a size-proportional CPU bug proportionally, gives no protection here.

The same input is also reachable in array and inline-table value positions. Tabs work as well as spaces. Multi-line literal strings (`'''`) are unaffected: they have no escape rule and therefore no ambiguity.

Proof of concept
const { load } = require('js-toml');
load('x = """' + '\\\n '.repeat(30)); // about 9 s, 100 bytes
Patch

Drop the trailing group:

{{escape}}{{whiteSpace}}{{newline}}

The accepted language is unchanged. The lexer pattern never performed line-ending-backslash trimming: `unescapeString` in `src/load/tokens/utils.ts` re-matches the whitespace run at interpretation time and does the trimming there. The enclosing content loop already absorbs the whitespace and newlines the group used to claim.

After the fix the 100-byte payload parses in about 0.05 ms, and a 60 kB version in about 11 ms.

Workarounds

None within the library for affected versions. Upgrade to 1.2.2. Callers that cannot upgrade and that parse untrusted input can reject documents containing `"""` before parsing, which is coarse but effective.

Credit

Found by the maintainer while triaging an unrelated report.

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

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:N
AltoBajoNinguno
IntegridadI:N
AltoBajoNinguno
DisponibilidadA:H
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
10.0/ 10Muy alto
Vector 10.0 (muy fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida Última
js-toml≤ 1.2.1
1.2.1
2.0.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
npmjs-toml
Corregida 1.2.2 0 d 2.0.1 no afectada
Versiones corregidas1.2.2
Explotación

Arsenal público

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

Referencias
Advisoryhttps://github.com/sunnyadn/js-toml/security/advisories/GHSA-j4cp-cc36-jxwg

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