llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Packagist · getgrav/grav

GHSA-4J79-3C34-CJVP

Publishers can escape the Twig content sandbox through trusted embedded templates

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

Parche disponible
Descargar PNG JSON
CVSS
—
high
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versión2.2.18
Exposición21 dDesde la divulgación, 31 oct 2026, 4:05 p. m.
Detección18 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 la severidad declarada por GHSA (alta) y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico parcial. Hay versiones corregidas disponibles.
Ojo con los rangos de versión, son traicioneros.Ponle una regla en tu SIEM y seguimos.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
31 oct 26
18 nov 26
21 nov 26
31 oct 26
6 nov 26
11 nov 26
16 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-4J79-3C34-CJVP divulgada
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

Grav's Twig content sandbox is applied per template source: page content and a few other sources are sandboxed, but templates loaded from files are trusted. Sandboxed content may still include or embed those trusted templates and pass them variables. A page editor (publisher) uses this to hand a trusted template the Grav container and walk it, outside the sandbox, to the account password hashes, pending reset tokens and the full configuration, or to delete every account and then recreate a super admin through first-run setup.

Affected versions

Grav 2.x from 2.0.0 up to and including 2.2.17. This has been the design since the sandbox arrived in 2.0.0-beta.2. Grav 1.7 has no Twig sandbox and is not affected.

Details

`GravSourcePolicy` sandboxes only `@Page:`, `@Var:` and `@EmailVar:` sources, and the allowed tags include `include`, `embed`, `extends`, `use`, `import` and `from`. Once a trusted template is running, it is not restricted. The `grav` global is the raw container. A gadget template that ships with the Form plugin does `{% set errors = attribute(form.messages, field.name) %}` and then renders an overridable block, so chained `embed` calls give one property read or zero-argument call per hop on any object. A core Flex debug template dumps `jsonSerialize()|yaml_encode` inside a trusted file, so the sandbox's dump guard sees an unsandboxed context. The Form template is only a gadget and is not itself at fault.

The reproducer shows the admin password hash printed into the page, while the direct spelling of the same read is blocked with a sandbox error. Zero-argument calls are actions: `delete` hops removed all accounts during the save-time scan, after which the API's first-run `/auth/setup` let an anonymous caller create a super admin. The same technique reads the viewer's session id and reaches Twig function closures outside the allowlist.

Impact

A publisher reads every account's hash and reset token and the full configuration (including mail credentials), or removes all accounts and takes over through setup. The attacker needs page edit rights.

Patches

Fixed in Grav 2.2.18. Grav now keeps the Twig sandbox switched on for the whole render of a sandboxed source (page content and `@Var:` or `@EmailVar:` strings). A theme, plugin or core template that the content loads with `include`, `embed`, `extends`, `use`, `import`, `from` or `block()` is held to the same tag, filter, function, method and property lists as the content itself, so it can no longer be used to walk objects outside the sandbox. A trusted render that PHP starts from inside the content, such as the template behind a modular page, stays trusted. Partials that content places on purpose keep working through a new setting, `security.twig_sandbox.trusted_partials`, a list of template names added to the built-in defaults (the Form plugin's `forms/form.html.twig`, `forms/data.html.twig`, `forms/data.txt.twig` and `forms/data.save.txt.twig`). A `{% include %}` of a listed partial renders it outside the sandbox, but only on the variables Grav itself hands the render. The content can add plain values (text, numbers and lists) under names Grav does not set, and it cannot pass objects. Names are matched exactly and only for `include`, so `embed`, `extends`, `use` and `import` of the same file stay sandboxed. No Form plugin update is needed. Sites that include theme or plugin partials from page content may need to list them: a partial that goes beyond the sandbox lists (for example one that uses `|raw` or `grav.*`) makes the page show its raw content, with the usual hint comment and a line in `logs/security.log`, until its name is added under `trusted_partials` or the include moves into the theme template. Only list a partial that prints its parameters escaped and does not use them to look things up on `grav` or `config`.

Credits

Discovered by Anthropic's OSS Scanner (ANT-2026-M89ZGP1V).

Versiones

Rangos afectados

Afectada Corregida
getgrav/grav≥ 2.0.0 < 2.2.18
2.0.0
2.2.18
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
Packagistgetgrav/grav
Corregida 2.2.18 — —
Versiones corregidas2.2.18
Explotación

Arsenal público

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

Referencias
Advisoryhttps://github.com/getgrav/grav/security/advisories/GHSA-4j79-3c34-cjvp

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