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

GHSA-JC8Q-6VCJ-4X25

Media-only accounts and anonymous uploaders can inject Twig into pages through media metadata and file names

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:06 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.
Esto huele a PoC esperando su momento.Medio riesgo, cero excusas.
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-JC8Q-6VCJ-4X25 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 builds an image's markup from its metadata sidecar and its file name. That text is HTML-escaped but is not protected against Twig, so Twig written into a picture's title, alt text, class, id or file name runs as page content Twig on any page that shows the picture. An account limited to media management (for example `api.media.*` with no page rights), or an anonymous visitor who uploads through a public form, can use this to run Twig on pages they cannot edit. Together with the `autoescape` tag it serves script to every visitor, a signed-in super admin included.

Affected versions

Grav 2.x from 2.0.0 up to and including 2.2.17. Page Twig is on by default for every page since Grav 2.0.19. Before that only pages with `process.twig: true` were exposed. Grav 1.7 has the same metadata and file-name flow, and 1.7 content Twig is not sandboxed, so a 1.7 page that enables Twig, accepts public uploads and shows a thumbnail link could give an anonymous uploader full Twig. That has not been reproduced and is being evaluated separately.

Details

`MediaObjectTrait::parsedownElement()` fills title, alt, class and id from the sidecar, and the medium URL puts the raw file name into `src`. Parsedown escapes HTML, but it leaves Twig delimiters (`{{`, `{%`) alone, and `Utils::checkFilename()` refuses `<`, `>` and `"` while accepting `{`, `}`, `%` and `|`. The placeholders that protect the page author's own Twig do not cover text derived from a medium, so that text reaches `Twig::processPage()` and is evaluated.

There are three actors. First, an API account holding only `api.media.*` (a role the API plugin explicitly keeps apart from page rights) patches a picture's title through the metadata endpoint. The reproducer uses a `photodesk` account and shows `<img src=x onerror=alert(document.domain)>` served on `/about`, a page that account cannot read or edit. Second, an anonymous visitor on a default configuration uploads through a public Form `type: file` field stored in the page folder, when the page also shows another medium with `?link`, `?lightbox` or `?display=thumbnail`: a file name such as `terms.pdf.thumb.{...}.png` becomes the thumbnail `src`. Third, anonymous visitors on sites with `auto_metadata_exif` enabled (off by default) can use the IPTC title. Script needs `{% autoescape false %}`. Without it, anonymous Twig still prints protected or unpublished page content, and `{{` in a file name makes the page answer 500.

Impact

An account with media rights only, or an anonymous uploader, serves script to every visitor of a page, a super admin included, which leads to a super-admin session. The default needs either a media-only account or a public upload form that shows another medium with a link or thumbnail option, so the rating is High and not Critical.

Patches

Fixed in Grav 2.2.18. The Markdown image renderer builds the element from the medium and writes any Twig opener in it as an entity, so text from a sidecar or a file name stays text when content Twig runs, while the author's own Twig in an image still runs. The `autoescape` tag is also left out of the content sandbox defaults, so sandboxed content can no longer switch output escaping off. Update the API plugin to 1.1.6 as well: it rejects `{{`, `{%` and `{#` in media metadata values. File names are covered by the core change.

Credits

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

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-jc8q-6vcj-4x25

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