GHSA-FHG3-XWWR-CQ26
Publishers can run shell commands through a Markdown image URL
Texto original en inglés · Ver en español
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-FHG3-XWWR-CQ26 divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
A page editor (publisher) can read any file and run shell commands as the web server user by saving a single Markdown image URL in a page, whenever the page is viewed. It bypasses the media action allowlist introduced after GHSA-ffmg-hfvg-jhg9. On sites where a public form mails its fields through the Email plugin with `process_markdown: true`, the same payload is reachable by an anonymous visitor.
Affected versions
Grav 2.x from 2.0.0 up to and including 2.2.17. The allowlist and the dispatch code that defeats it date from 2.0.0-rc.10. Grav 1.7 has no allowlist at all (any method on the medium can be called from a Markdown image URL), so publisher to code execution has always been open there. Because it is publisher-only, no 1.7 release is part of this advisory. The anonymous `process_markdown` route also exists on 1.7, but only under that non-default setting.
Details
Markdown image URLs can carry media actions (`photo.jpg?resize=100,100`). `Excerpts` gates these with `method_exists($medium, $name)`, so a name that is not a real method of the medium is treated as a harmless URL parameter. A scoped name such as `self::addMetaFile` is not a method name, so it passes the gate as a URL parameter. The dispatch then uses `call_user_func_array([$medium, $name], $args)`, which resolves `self::x`, `parent::x` and `Ancestor::x` to the real method. Each action replaces `$medium` with the previous return value, so a string result makes the next action a static call on any class, for example `Symfony\Component\Process\Process::fromShellCommandline` followed by `run`. `Link::__call()` resolves scoped names the same way, which also reaches the Lightbox Gallery plugin's media actions (see GHSA-jq4h-4q3q-hr32). The gate also runs only once against the original medium, while actions such as `display=thumbnail` and `link` swap `$medium` for an object of another class.
The reproducer shows the editor's page leaking the account hash in a 500 response, and `id` running as `www-data`, both for the editor and with no account through a public contact form that mails its fields through the Email plugin with Markdown processing enabled.
Impact
A publisher gets file read and code execution as the web server user, which means full control of the site and server account. The default needs a publisher account, so the rating is High. Sites that enable `process_markdown` in the Email plugin on a form that anonymous visitors can submit are exposed to anonymous code execution.
Patches
Fixed in Grav 2.2.18. Actions are dispatched with `$medium->{$method}(...$args)`, so scoped names fall through to the magic call and not to the real method. The `$medium` variable only keeps results that are media or link objects. The `Link` class gets the same change, and the allowlist gate is evaluated for each action against whatever the current medium is.
Workarounds
Leave `process_markdown` disabled in the Email plugin (the default), which closes the anonymous route. The publisher route has no configuration workaround.
Credits
Discovered by Anthropic's OSS Scanner (ANT-2026-KH22PYHY).
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistgetgrav/grav |
Corregida | 2.2.18 | — | — |
2.2.18Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/getgrav/grav/security/advisories/GHSA-fhg3-xwwr-cq26Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
