llamaCVEVulnerability Intelligence
/
Advisory · GitHub · NuGet · Scriban

GHSA-MVMW-9JXC-7PR2

Three template-only paths raise an uncatchable StackOverflowException under default limits (postfix chains bypass ExpressionDepthLimit; array comparison and `object.eval` recursion are unguarded)

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ón28 dDesde la divulgación, 24 oct 2026, 4:12 a. m.
Detección26 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?Ponle una regla en tu SIEM y seguimos.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Parche 7.5.3
Monitoreo
Detectada +1
24 oct 26
20 nov 26
21 nov 26
24 oct 26
31 oct 26
7 nov 26
14 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-MVMW-9JXC-7PR2 divulgada · CVSS 7.5 (GitHub)
Remediación Parche 7.5.3 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

Severity: High — CVSS 3.1 7.5 `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- AV:N / PR:N / UI:N: any application that renders attacker-supplied templates (the use case the "safe runtime" targets) can be hit by a single request; the scoring matches the earlier advisories for this family (GHSA-wgh7-7m3c-fx25, GHSA-xcx6-vp38-8hr5).
- AC:L: no special host configuration. Default `ParserOptions` and `new TemplateContext()`.
- A:H: a `StackOverflowException` cannot be caught in .NET. The whole host process terminates, taking every other request and tenant with it.
- C/I:N: no data exposure.

Packages: NuGet `Scriban`, `Scriban.Signed`
Affected versions: <= 7.5.2 (verified on 7.5.1 = master `eb8d441`). Earlier versions not checked individually; the code paths below predate the 7.x depth-limit fixes.
Patched versions: 7.5.3

Description

Scriban's documented safety controls for untrusted templates are `ParserOptions.ExpressionDepthLimit` (default 250, "disallow deep/potential stack-overflow exploits"), `RecursiveLimit` (100) and `ObjectRecursionLimit` (20). Three code paths bypass all of them, so a small template crashes the host process with a stack overflow:

  1. Postfix chains bypass `ExpressionDepthLimit`. The member (`.a`, `?.a`), indexer (`[0]`) and explicit-call (`(1)`) postfix loop in `src/Scriban/Parsing/Parser.Expressions.cs` (member loop ~L241-293, indexer ~L315-337, call ~L648-707) never calls `EnterExpression()`; the binary-operator path does (~L428). The loop is iterative, but the AST it builds nests N deep. Evaluation then recurses once per link: `ScriptMemberExpression.GetTargetObject` (`Syntax/Expressions/ScriptMemberExpression.cs` ~L136) → `TemplateContext.GetValue` → `GetOrSetValue` (`TemplateContext.cs` ~L1336), and `ScriptIndexerExpression.GetOrSetValue` (~L104). `ScriptPrinter` (`ToText()`) and `ScriptRewriter`/`ScriptFormatter` recurse on the same AST without a guard. Affects both `Template.Parse` and `Template.ParseLiquid`. Every other nesting form (binary operators, pipes, parentheses, unary operators, `if`/`for`/`else if`/`when`/`capture`/`func` nesting, array and object literals) is correctly stopped with "statement depth limit `250` was reached".
  2. Array comparison recurses without a guard. `ScriptArray.CompareTo` (`src/Scriban/Runtime/ScriptArray.cs` ~L617-655) compares element-wise through `ScriptBinaryExpression.Evaluate` with no depth limit, no `ObjectRecursionLimit` check and no cycle detection. `==`, `!=`, `<`, `<=`, `>`, `>=` on a self-referential array, or on two arrays ~450 levels deep (buildable within the default `LoopLimit`), overflow the stack. Printing, `object.to_json`, `array.join`, `array.compact` and string concatenation on the same cyclic array all throw the catchable "Structure is too deeply nested or contains reference loops"; only comparison is unguarded.
  3. `object.eval` / `object.eval_template` bypass `RecursiveLimit`. `ObjectFunctions.Eval` (`src/Scriban/Functions/ObjectFunctions.cs` ~L72) and `EvalTemplate` (~L127) parse and evaluate a nested page without `context.EnterRecursive`, so a string that evaluates itself recurses until the stack is gone. Their `catch (Exception ex) { throw new ArgumentException(...) }` blocks also run exception dispatch on an almost-full stack (the overflow is reported inside `System.Runtime.EH.DispatchEx`). By contrast, a self-`include` correctly throws `Exceeding number of recursive depth limit 100`.

Path 1 is another incomplete fix in the GHSA-wgh7-7m3c-fx25 / GHSA-p6q4-fgr8-vx4p / GHSA-6q7j-xr26-3h2c line. Path 2 is the comparison sibling of GHSA-grr9-747v-xvcp / GHSA-xcx6-vp38-8hr5.

Proof of concept

Host (defaults only, nothing exposed):

using Scriban;
using Scriban.Runtime;

var template = Template.Parse(text);          // or Template.ParseLiquid for the Liquid variant
var ctx = new TemplateContext();
ctx.PushGlobal(new ScriptObject());
template.Render(ctx);                         // process terminates

Templates (each one crashes the process; tested on .NET 10.0.13, Windows x64, main thread with a 1 MB stack):

// 1. postfix chain: ~4 KB, parses with HasErrors == false
var text = "{{ x = {}; x" + string.Concat(Enumerable.Repeat(".a", 2000)) + " }}";
// variants: "[0]" x 800+, "?.a" x 3000, "f(1)" x 3000; Liquid: "{{ x" + ".a" x 3000 + " }}" via ParseLiquid.
// Page.Format(...) overflows at ~5000 links, ToText() at ~100000 links.
{{ a = [1]; a[0] = a; b = [1]; b[0] = b; a == b }}
{{ a = []; b = []; for i in 1..450; a = [a]; b = [b]; end; a == b }}
{{ s = 'object.eval s'; object.eval s }}
{{ s = '{{ object.eval_template s }}'; object.eval_template s }}

Observed (path 1):

Stack overflow.
Repeated 1374 times:
   at Scriban.TemplateContext.GetOrSetValue(Scriban.Syntax.ScriptExpression, System.Object, Boolean)
   at Scriban.TemplateContext.GetValue(Scriban.Syntax.ScriptExpression)
   at Scriban.Syntax.ScriptMemberExpression.GetTargetObject(Scriban.TemplateContext, Boolean)
   at Scriban.Syntax.ScriptMemberExpression.GetValue(Scriban.TemplateContext)

Observed (path 2): `Stack overflow. Repeated 377 times: … ScriptArray`1.CompareTo … ScriptArray`1.TryEvaluate … ScriptBinaryExpression.Evaluate`.
Observed (path 3): `Stack overflow. at System.Runtime.EH.DispatchEx(...) at Scriban.Syntax.ScriptFunctionCall.Call(...) … at Scriban.Functions.ObjectFunctions.Eval(...)`.

Thresholds on a 1 MB stack: ~1400 `.a` links, ~700 `[0]` links, ~450 nesting levels for comparison. Worker threads with smaller stacks fail sooner.

Impact

Any application that parses or renders attacker-influenced templates, or passes attacker-controlled strings to `object.eval`/`object.eval_template`, can be terminated by one request of a few KB (path 1) or under 60 bytes (paths 2 and 3). Exception handlers, `CancellationToken`, and all `TemplateContext` limits are ineffective. Recovery requires a process restart.

Suggested remediation

  • Parser: call `EnterExpression()`/`LeaveExpression()` for each postfix link, so chain length counts against `ExpressionDepthLimit` and produces the usual parse error.
  • `ScriptArray.CompareTo`: track depth against `ObjectRecursionLimit` (as `ObjectToString` does) and raise the same catchable error.
  • `object.eval` / `object.eval_template`: wrap the nested evaluation in `EnterRecursive`/`ExitRecursive` like `include`; let `ScriptRuntimeException` pass through without re-wrapping.
  • Defence in depth: call `RuntimeHelpers.EnsureSufficientExecutionStack()` (or `TryEnsureSufficientExecutionStack`) in the recursive evaluation entry points (member/indexer `GetValue`, function call, `CompareTo`, printer/rewriter visit), converting `InsufficientExecutionStackException` into a `ScriptRuntimeException`. This closes the family instead of each node type one at a time.

---
🤖 Generated with Claude Code https://claude.com/claude-code

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.2
7.5.2
7.6.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
nugetScriban
Corregida 7.5.3 0 d 7.6.1 no afectada
nugetScriban.Signed
Corregida 7.5.3 0 d 7.6.1 no afectada
Versiones corregidas7.5.3
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-mvmw-9jxc-7pr2

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