GHSA-V4XP-J34H-FR2V
Incomplete URL detection in SVG sanitization allows loading of external stylesheets
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-V4XP-J34H-FR2V divulgada · CVSS 5.1 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
TL;DR
This vulnerability affects all Kirby sites that accept SVG/SVGZ uploads and that might have potential attackers in the group of authenticated Panel users. It also affects sites and plugins that pass untrusted SVG data through the `Sane` API.
Both the sanitization and the validation path are affected, so Kirby's default file upload protection did *not* reject such files. Sites that do not accept SVG/SVGZ uploads and don't use the `Sane` API with untrusted input are *not* affected. The vulnerability does not allow JavaScript execution.
This vulnerability is of medium severity for affected sites.
----
Affected components
Only SVG and SVGZ handling is affected. `Sane\Svg` and `Sane\Svgz` allow `<style>` elements in SVG files, but check every URL found in the CSS against the allowed domains, which are empty by default, and reject any URL pointing at an external host. In affected releases that check did not cover CSS `@import` rules.
The check is reached from Kirby's default upload protection, which validates the contents of every uploaded file, and from `Sane::sanitize()`, `Sane::validate()`, `Sane::sanitizeFile()`, `Sane::validateFile()`, `$file->sanitizeContents()` and `$file->validateContents()` in site or plugin code, e.g. in a `file.create:before` hook that cleans uploaded SVG files.
The `writer` and `list` fields are not affected. Plain XML files are not affected either, as `Sane\Xml` allows any domain by design.
Impact
In affected releases, an SVG could reference an external stylesheet through a CSS `@import` rule and still pass sanitization, which returned the `<style>` element unchanged, and validation, which reported no error. An authenticated Panel user who is allowed to upload files could therefore store such an SVG in a place where Kirby's own upload protection had declared the file safe.
The referenced stylesheet is loaded whenever the SVG is rendered as a document rather than as an image: when a visitor opens the file's media URL directly, when the file is embedded via `<object>` or `<iframe>`, and when the site inlines the SVG source into its own HTML, which is a common way to embed icons and logos. It is *not* loaded when the SVG is used in an `<img>` element or as a CSS background image.
Where it is loaded, each view discloses the visitor's IP address, user agent and referring URL to the server hosting the stylesheet, which the attacker can replace at any time. The CSS applies to the surrounding document, so it can also alter what visitors see on that page and leak limited amounts of the data the page renders.
The vulnerability does not allow the execution of JavaScript and does not grant access to content, sessions or files on the server.
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::extractUrls()` also detects CSS `@import` rules, so a referenced stylesheet is checked against the allowed domains like every other URL.
Note that SVG files that were accepted before the patch may still reference an external stylesheet.
Workarounds
Until you can update:
- Do not accept SVG or SVGZ uploads from users you do not fully trust.
- Review stored SVG and SVGZ files for `@import` rules and remove them.
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-v4xp-j34h-fr2vLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
