llamaCVEVulnerability Intelligence
/
Advisory · GitHub · NuGet · Scriban

GHSA-JHV7-5X5P-VH8W

ScriptObject string conversion bypasses the string length limit and can allocate multi-gigabyte strings

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.
Nivel de sospecha: ceja levantada.Saqué la lupa: aquí hay algo que investigar.
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-JHV7-5X5P-VH8W 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

Rendering a `ScriptObject` with many members bypasses `LimitToString` during `IFormattable` conversion.

Details

`TemplateContext.ObjectToString` dispatches `IFormattable` to `ToString` (`src/Scriban/TemplateContext.Helpers.cs:187-191`). `ScriptObject` implements `IFormattable` (`ScriptObject.cs:29`) and its `ToString` (`ScriptObject.cs:362-402`) concatenates members without cumulative length tracking; the outer check (`TemplateContext.Helpers.cs:125-132`) runs only after the allocation and appends `...` instead of truncating.

Enforce the limit while building in `ScriptObject.ToString` (and any other `IFormattable` implementation that formats an object graph), not only after the fact. For example, before each append:

var itemText = context.ObjectToString(item.Value, true) ?? string.Empty;
if (context.LimitToString > 0 &&
    (long)result.Length + itemText.Length + 4 > context.LimitToString)
{
    if (context.OnStringLimit == ScriptLimitBehavior.Throw)
        throw new ScriptRuntimeException(context.CurrentSpan,
            $"String conversion reaches LimitToString `{context.LimitToString}`.");

    var remaining = Math.Max(0, context.LimitToString - result.Length - 4);
    result.Append(itemText.AsSpan(0, Math.Min(itemText.Length, remaining)));
    result.Append("...");
    break;
}
result.Append(itemText);

Also change the outer fallback at `TemplateContext.Helpers.cs:131` to truncate the result (or throw) rather than returning `result + "..."` for an already oversized string.

A simpler immediate fix is to check `stream.Length` at the start of each `WriteValue`/after each member append and throw once it exceeds `LimitToString * 4` bytes, then verify the decoded string length before returning. The exact byte/char conversion should be documented because `LimitToString` is measured in UTF-16 characters.

Proof of concept

Default context, no host objects:

var ctx = new TemplateContext();
ctx.PushGlobal(new ScriptObject());
var members = string.Join(",", Enumerable.Range(0, 300).Select(i => $"k{i}:s"));
var template = "{{ s = 'a' * 1000000; o = {" + members + "}; o }}";
Template.Parse(template).Render(ctx);

Observed:

MODE=scriptobject OK resultChars=1048579 elapsedMs=1239 peakWS=2030MB

The output is truncated to 1,048,579 chars, but ~300 MB was already built inside `ScriptObject.ToString` before the outer check ran.

Impact

Memory exhaustion/OOM from a ~2 KB template; `OnStringLimit = Throw` is also too late.

Remediation in Scriban 7.6.0

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

ScriptObject and enumerable string formatting now share the remaining conversion budget with nested values, check each append, and stop visiting members when the budget is exhausted. ObjectToString clips over-limit results before appending its compatibility ellipsis. OnStringLimit.Throw reports a ScriptRuntimeException; the default truncation policy is preserved.

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-jhv7-5x5p-vh8w

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