llamaCVEVulnerability Intelligence
/
Advisory · GitHub · NuGet · Scriban

GHSA-VQM7-RM7V-QQ3F

object.to_json ignores the string length limit and allows multi-gigabyte JSON allocation

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

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ón13 dDesde la divulgación, 7 nov 2026, 5:23 p. m.
Detección12 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.
Yo la vigilo, tú la programas. ¿Trato?Medio riesgo, cero excusas.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Parche 7.6.0
Monitoreo
Detectada +1
7 nov 26
20 nov 26
21 nov 26
7 nov 26
11 nov 26
14 nov 26
18 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-VQM7-RM7V-QQ3F divulgada · CVSS 7.5 (GitHub)
Remediación Parche 7.6.0 Scriban · 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

`object.to_json` writes to an unbounded `MemoryStream`; only .NET's JSON length cap limits output.

Details

`ObjectFunctions.ToJson` (`src/Scriban/Functions/ObjectFunctions.cs:576-596`) and its `WriteValue` helper (`lines 598-680`) never check `context.LimitToString`. Repeated serialization re-escapes backslashes and control characters, amplifying a 1 MB input.

Suggested fix. Enforce the limit while writing. Use a `Stream` wrapper passed to `Utf8JsonWriter` that counts bytes and throws once the output cannot fit `LimitToString` (taking UTF-8/UTF-16 worst case into account), or check `stream.Length` after each `WriteValue` and before `GetString`:

// Conceptual: reject before the buffer grows past the configured limit.
private sealed class LimitStream : Stream
{
    private readonly Stream _inner;
    private readonly long _maxBytes;
    public override void Write(ReadOnlySpan<byte> buffer)
    {
        if (_inner.Length + buffer.Length > _maxBytes)
            throw new ScriptRuntimeException(span,
                $"JSON output exceeds LimitToString `{limit}`.");
        _inner.Write(buffer);
    }
    // ...
}
Proof of concept

Default context, no host objects:

var ctx = new TemplateContext();
ctx.PushGlobal(new ScriptObject());
var template = """{{ s = '\n' * 1000000; for i in 1..9; s = s | object.to_json; end; s | string.size }}""";
Template.Parse(template).Render(ctx);

Observed:

MODE=tojson OK resultChars=9 elapsedMs=2707 peakWS=3377MB

The result is `257000592` chars. A 10th pass throws the .NET JSON length error only after the same ~3.4 GB allocation.

Impact

An ~85-byte template causes a 3.4 GB heap peak and is repeatable; memory-exhaustion DoS.

Remediation in Scriban 7.6.0

Upgrade either distribution, Scriban or Scriban.Signed, to 7.6.0 or later.

object.to_json now checks LimitToString incrementally using the UTF-16 character length of the JSON output, including escape sequences. It bounds individual string and property-name inputs before reserving escape buffers and flushes tokens to a bounded stream. An over-limit operation throws rather than returning truncated, invalid JSON. ScriptObject serialization also follows the guarded traversal.

No CVE identifier is requested for this advisory.

_Remediation notes and package metadata updated by CodeAlta._

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
Scriban · Scriban.Signed≤ 7.5.3
7.5.3
7.6.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
nugetScriban
Corregida 7.6.0 0 d 7.6.1 no afectada
nugetScriban.Signed
Corregida 7.6.0 0 d 7.6.1 no afectada
Versiones corregidas7.6.0
Explotación

Arsenal público

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

Referencias
Advisoryhttps://github.com/scriban/scriban/security/advisories/GHSA-vqm7-rm7v-qq3f

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