{"id":"CVE-2021-29460","aliases":["CVE-2021-29460","GHSA-qgp4-5qx6-548g"],"related":[],"kind":"vulnerability","state":"published","title":"Cross-site scripting (XSS) from unsanitized uploaded SVG files","summary":"Kirby is an open source CMS. An editor with write access to the Kirby Panel can upload an SVG file that contains harmful content like `<script>` tags. The direct link to that file can be sent to other users or visitors of the site. If the victim opens that link in a browser where they are logged in to Kirby, the script will run and can for example trigger requests to Kirby's API with the permissions of the victim. This vulnerability is critical if you might have potential attackers in your group of authenticated Panel users, as they can escalate their privileges if they get access to the Panel session of an admin user. Depending on your site, other JavaScript-powered attacks are possible. Visitors without Panel access can only use this attack vector if your site allows SVG file uploads in frontend forms and you don't already sanitize uploaded SVG files. The problem has been patched in Kirby 3.5.4. Please update to this or a later version to fix the vulnerability. Frontend upload forms need to be patched separately depending on how they store the uploaded file(s). If you use `File::create()`, you are protected by updating to 3.5.4+. As a work around you can disable the upload of SVG files in your file blueprints.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Kirby is an open source CMS. An editor with write access to the Kirby Panel can upload an SVG file that contains harmful content like `<script>` tags. The direct link to that file can be sent to other users or visitors of the site. If the victim opens that link in a browser where they are logged in to Kirby, the script will run and can for example trigger requests to Kirby's API with the permissions of the victim. This vulnerability is critical if you might have potential attackers in your group of authenticated Panel users, as they can escalate their privileges if they get access to the Panel session of an admin user. Depending on your site, other JavaScript-powered attacks are possible. Visitors without Panel access can only use this attack vector if your site allows SVG file uploads in frontend forms and you don't already sanitize uploaded SVG files. The problem has been patched in Kirby 3.5.4. Please update to this or a later version to fix the vulnerability. Frontend upload forms need to be patched separately depending on how they store the uploaded file(s). If you use `File::create()`, you are protected by updating to 3.5.4+. As a work around you can disable the upload of SVG files in your file blueprints.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nAn editor with write access to the Kirby Panel can upload an SVG or XML file that contains harmful content like `<script>` tags. The direct link to that file can be sent to other users or visitors of the site. If the victim opens that link in a browser where they are logged in to Kirby, the script will run and can for example trigger requests to Kirby's API with the permissions of the victim.\n\nThis vulnerability is critical if you might have potential attackers in your group of authenticated Panel users. They can escalate their privileges if they get access to the Panel session of an admin user. Depending on your site, other JavaScript-powered attacks are possible.\n\nVisitors without Panel access can only use this attack vector if your site allows SVG or XML file uploads in frontend forms and you don't already validate or sanitize uploaded SVG or XML files.\n\nThe attack requires user interaction by another user or visitor and *cannot* be automated.\n\n### Patches\n\n#### Uploads in the Panel\n\nThe problem has been patched in [Kirby 3.5.4](https://github.com/getkirby/kirby/releases/tag/3.5.4) by validating uploaded SVG and XML files and rejecting potentially harmful files. Please update to this or a [later version](https://github.com/getkirby/kirby/releases/) to fix the vulnerability.\n\n#### Frontend upload forms\n\nFrontend upload forms need to be patched separately depending on how they store the uploaded file(s). If you use `File::create()`, you are protected by updating to Kirby 3.5.4+.\n\n#### Validate existing files\n\nAlready uploaded files are *not* automatically validated again. If you are not sure if you have been impacted by this vulnerability in the past, we recommend to run all site files through the validator classes after updating to Kirby 3.5.4. You can use the following test script by pasting it into a template or uploading it to your web root:\n\n```php\n<?php\n\n@include_once __DIR__ . '/kirby/bootstrap.php';\n\nif (version_compare(kirby()->version(), '3.5.4', '<') === true) {\n  die('This script requires Kirby 3.5.4+.');\n}\n\n$objects = [\n  // the site itself\n  site(),\n\n  // all pages and drafts\n  ...site()->index(true)->values(),\n\n  // all users\n  ...kirby()->users()->values()\n];\n\n$errors = false;\nforeach ($objects as $object) {\n  foreach ($object->files() as $file) {\n    try {\n      // validate the contents lazily\n      // (if a validator exists)\n      $file->validateContents(true);\n    } catch (\\Kirby\\Exception\\InvalidArgumentException $e) {\n      echo $file->id() . ': ' . $e->getMessage() . \"<br>\\n\";\n      $errors = true;\n    }\n  }\n}\n\nif ($errors === false) {\n  echo 'No validation errors found.';\n}\n```\n\nYou only need to run this validator script once as future uploads will automatically be validated. If the script prints \"No validation errors found\", you have not been impacted by the vulnerability so far.\n\nErrors that it lists may or may not be critical as our validator classes also catch files with an invalid data structure or less harmful attacks like the [\"billion laughs\" denial-of-service attack](https://en.wikipedia.org/wiki/Billion_laughs_attack) or the usage of external sources. We recommend to review and fix each listed error manually until the script no longer finds any validation errors.\n\n**Please delete the script again after you have used it.**\n\n### Workarounds\n\nIf you cannot update to Kirby 3.5.4, you can disable the upload of SVG and XML files in your [file blueprints](https://getkirby.com/docs/reference/panel/blueprints/file#accept) and validate or replace your already uploaded files once.\n\n### Credits\n\nThanks to @sreenathr10 for reporting the problem.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Kirby es un CMS de código abierto.&#xa0;Un editor con acceso de escritura al Kirby Panel puede cargar un archivo SVG que contenga contenido dañino como etiquetas \"(script)\".&#xa0;El enlace directo a ese archivo puede ser enviado a otros usuarios o visitantes al sitio.&#xa0;Si la víctima abre ese enlace en un navegador donde ha iniciado sesión en Kirby, el script se ejecutará y puede, por ejemplo, desencadenar peticiones a la API de Kirby con los permisos de la víctima.&#xa0;Esta vulnerabilidad es crítica si puede tener atacantes potenciales en su grupo de usuarios autenticados del Panel, ya que pueden escalar sus privilegios si consiguen acceso a la sesión del Panel de un usuario administrador.&#xa0;Dependiendo de su sitio, son posibles otros ataques basados ??en JavaScript.&#xa0;Los visitantes sin acceso al Panel solo pueden usar este vector de ataque si su sitio permite la carga de archivos SVG en formularios de frontend y usted no&#xa0;sanea los archivos SVG cargados.&#xa0;El problema ha sido parcheado en Kirby versión 3.5.4.&#xa0;Actualice a esta o una versión posterior para corregir la vulnerabilidad.&#xa0;Los formularios de carga de frontend deben parchearse por separado dependiendo de cómo almacenan los archivos cargados.&#xa0;Si usa la función \"File::create()\", está protegido actualizando a 3.5.4+.&#xa0;Como solución alternativa, puede desencadenar la carga de archivos SVG en sus planos de archivo","source":"nvd"}],"published":"2021-04-27T20:10:13.000Z","modified":"2026-07-08T06:28:27.942Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:N","score":7.6,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:N","score":7.6,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:N","score":7.6,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:M/Au:S/C:N/I:P/A:N","score":3.5,"rating":"LOW"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":"< 3.5.4","status":"affected"}],"vendor":"getkirby","product":"kirby","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.5.4"}],"ecosystem":"Packagist","package":"getkirby/cms","purl":"pkg:composer/getkirby/cms","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.5.4"}],"vendor":"getkirby","product":"kirby","cpe":"cpe:2.3:a:getkirby:kirby:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/getkirby/kirby/security/advisories/GHSA-qgp4-5qx6-548g","tags":["exploit","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/getkirby/kirby/releases/tag/3.5.4","tags":["release-notes","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"http://packetstormsecurity.com/files/162359/Kirby-CMS-3.5.3.1-Cross-Site-Scripting.html","tags":["exploit","third-party-advisory","vdb-entry","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-29460","tags":["advisory"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-29460","url":"https://www.cve.org/CVERecord?id=CVE-2021-29460","licence":"CVE Terms of Use","modified":"2024-08-03T22:02:51.975Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-qgp4-5qx6-548g","url":"https://github.com/advisories/GHSA-qgp4-5qx6-548g","licence":"CC-BY-4.0","modified":"2026-07-08T06:28:27.942Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-29460","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-29460","licence":"Public domain","modified":"2026-06-17T03:47:41.207Z"}],"updatedAt":"2026-11-25T22:58:01.061Z","epss":{"score":0.03174,"percentile":0.88381,"date":"2026-12-01T12:00:22.000Z"}}