GHSA-JQ4H-4Q3Q-HR32
Lightbox Gallery: page editor can read server files into a public page through shortcode media actions
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-JQ4H-4Q3Q-HR32 divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The Lightbox Gallery plugin turns the query string of the `image`, `thumb` and `thumb_options` shortcode values into method calls on the page's media object, and unlike Grav core it does not check the method against core's list of allowed media actions. A page editor can therefore call any public method of the medium. Chaining `addMetaFile` with an accessor such as `value`, `toYaml` or `toJson` reads any YAML file the web server can read and prints its contents into the page HTML, where anonymous visitors see it too.
Affected versions
Lightbox Gallery 1.1.0 through 1.3.1 on Grav 2.x. On Grav 1.7 the plugin adds nothing beyond core, because core 1.7's own Markdown media path already calls any medium method.
Details
`LightboxGalleryShortcode::getMedia()`, `buildThumbUrl()` and `buildImageUrl()` split the shortcode value at `?`, run the rest through `parse_str()`, and call `$media->$key(...$args)` for every key, replacing `$media` with the return value. Grav 2 core only calls a real medium method from page content when `Medium::isAllowedAction()` accepts it (`Excerpts::processMediaActions()`); the plugin skipped that check.
`ImageMedium::addMetaFile()` loads a YAML file from a caller-chosen path (relative, absolute or stream) into the medium's data and returns the medium, so a second action in the same value can print that data. Whatever the last call returns is passed to the thumbnail template, which prints it into the `src` attribute. A publisher can stop Markdown from encoding the `&` between the two actions by setting `process: markdown: false` in their page or by wrapping the shortcode in an HTML block.
Reproduced on Grav 2.2.12 with Lightbox Gallery 1.3.1 and Shortcode Core 6.2.6, with an account holding only page-edit permissions (`admin.pages`, `api.pages.*`, no super): a page saved through the Pages API with a `thumb` value chaining `addMetaFile` and `value` served a planted secret from `user/data` in the public HTML, and a chain ending in `toYaml` served the full contents of a user account file, including the password hash and access map. The same chain in a plain Markdown image is ignored by core.
The original report demonstrated the allowlist bypass with a read-only getter. The file read described above was found while confirming it.
Impact
An account with page-edit permission can read files its role does not grant, such as other accounts' password hashes and 2FA secrets, plugin configuration with API keys, and form submissions stored as YAML, and publish them in a page that anyone can view. Calls that raise an error also stop the page from rendering.
Patches
Fixed in Lightbox Gallery 1.3.2. Media actions in shortcode values follow the same rule as core: a real method of the medium is only called when it is an allowed media action, other names go to the medium's own action handler, and an action that fails or does not return a medium is skipped.
Credits
Reported by @slalabs.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagisttrilbymedia/lightbox-gallery |
Corregida | 1.3.2 | — | — |
1.3.2Arsenal 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-jq4h-4q3q-hr32Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
