GHSA-45C7-FXC7-4WJH
Cross-site scripting (XSS) from incomplete SVG and XML sanitization in `Dom::sanitize()`
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:P/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-45C7-FXC7-4WJH divulgada · CVSS 7.4 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
TL;DR
This vulnerability affects Kirby sites that embed SVG/XML content inline, e.g. an uploaded SVG rendered with the `svg()` helper. It requires an authenticated Panel user who can upload files, or other code that passes untrusted SVG/XML through `Sane` or `Dom` classes.
Sites that deliver uploaded SVG files the way Kirby does by default (from their media URL, as `<img src>` or as a standalone `image/svg+xml` document) are *not* affected.
This vulnerability is of high severity for affected sites.
----
Affected components
`Dom::sanitize()` removes unwanted or malicious elements and attributes from DOM documents. It is the basis of the `Kirby\Sane` class package, which Kirby uses to check uploaded files. Site and plugin code may call `Sane\Svg`, `Sane\Svgz`, `Sane\Xml`,`Sane::sanitizeFile()`, `Sane::validateFile()`, `$file->sanitizeContents()` or `$file->validateContents()` directly as well, for example in a `file.create:before` hook.
The `Sane\Html` handler is not affected, and neither are the `writer` and `list` fields that build on it.
Impact
In affected releases, `Dom::sanitize()` inspected only elements and attributes, so comments and CDATA sections were carried into the sanitized document unchanged. An SVG or XML file could therefore hold markup that the XML parser considered safe/inert, but became active as soon as the document is embedded inline in an HTML page.
Where a template renders such a file inline, the injected script runs in the browser of everyone who views that page. As the Panel is served from the same origin as the site frontend, this lets a lower-privileged editor act with the permissions of higher-privileged users who view the content, up to full Panel access.
Patches
The problem has been patched in Kirby 5.6.0 https://github.com/getkirby/kirby/releases/tag/5.6.0 and Kirby 4.9.6 https://github.com/getkirby/kirby/releases/tag/4.9.6.
In these releases, `Dom::sanitize()` now also examines comments, CDATA sections and processing instruction data, and removes or escapes content that an HTML parser would read as markup.
Note that SVG and XML files that were uploaded or sanitized before the patch may still contain such content.
Workarounds
Until you can update, either of these removes the exposure:
- Stop embedding uploaded SVG files inline. Deliver them from their media URL or with `<img src>` instead of e.g. the `svg()` helper.
- Do not accept SVG uploads from users you do not fully trust.
Credits
Thanks to Markus Magnuson (@alimony) for responsibly reporting the identified issue.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistgetkirby/cms |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/getkirby/kirby/security/advisories/GHSA-45c7-fxc7-4wjhLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
