CVE-2026-54002: Kirby Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-wr9h-4r83-f4v6
CWE-87 CWE-79
Published
Advisory Summary

CVE-2026-54002 is a HIGH cross-site scripting vulnerability (CWE-87: Improper Neutralization of Alternate XSS Syntax) affecting Kirby libraries in the Packagist ecosystem. The issue involves cross-site scripting (xss) from incomplete html/xml sanitization in `dom::sanitize()`. Remediation is available by upgrading affected packages to version 4.9.4, 5.4.4.

CVE-2026-54002 at a Glance

CVE Identifier CVE-2026-54002
GHSA Identifier GHSA-wr9h-4r83-f4v6
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-87: Improper Neutralization of Alternate XSS Syntax
Affected Product Kirby
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix CVE-2026-54002

To remediate this vulnerability, upgrade all affected Kirby dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

getkirby/cms fixed: 4.9.4
Upgrade getkirby/cms to 4.9.4
getkirby/cms fixed: 5.4.4
Upgrade getkirby/cms to 5.4.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for getkirby/cms

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-54002, inspect your project dependencies for Kirby:

inspect dependencies for getkirby/cms

Analyze the terminal output to locate any version of Kirby in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.9.4), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-87: Improper Neutralization of Alternate XSS Syntax, where the product does not neutralize or incorrectly neutralizes user-controlled input for alternate script syntax. In Kirby, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### TL;DR This vulnerability affects Kirby sites and plugins that use the `writer` or `list` fields or that use `$dom->sanitize()`, `Sane::sanitize()`, `Sane\Html::sanitize()`, `Sane\Svg::sanitize()`, `Sane\Xml::sanitize()`, `Sane::sanitizeFile()` or `$file->sanitizeContents()` with untrusted input. It was possible to inject malicious markup as children of an unknown HTML/XML tag, which would then be passed through `Dom::sanitize()` without being correctly sanitized according to the provided sanitization rules, causing a cross-site scripting (XSS) risk. **This vulnerability is of high severity for affected sites.** The default file upload protection is *not* affected, so sites that only *validate* uploaded files are not exposed to this vulnerability. The vulnerability can only be exploited by authenticated users. ---- ### Introduction Cross-site scripting (XSS) is a type of vulnerability that allows executing any kind of JavaScript code inside the site frontend or Panel session of the same or other users. In the Panel, a harmful script can, for example, trigger requests to Kirby's API with the permissions of the victim. In a *stored* XSS attack, the malicious payload is saved into the content data and has the potential to affect other users or site visitors. Such vulnerabilities are 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. A specific class of stored XSS is auto-firing, meaning the maliciously injected JavaScript code is executed by the browser when the page loads without the victim having to perform a specific action. ### Affected components The `Dom::sanitize()` method allows removing unwanted or malicious elements or attributes from DOM documents (which includes HTML, SVG or arbitrary XML data). Sanitized content is supposed to be protected against cross-site scripting (XSS) attacks by removing their impact from untrusted content input. `Dom::sanitize()` internally checks all nodes and attributes of the DOM document. It removes nodes, attributes, processing instructions, doctypes and namespaces that are not allowed according to the provided configuration. Nodes with tags that have been explicitly blocklisted are removed together with their children. Nodes with explicitly allowlisted tags are kept. If a tag is neither allowlisted nor blocklisted, nodes with that tag are unwrapped by `Dom::unwrap()` (meaning the children are kept). `Dom::sanitize()` is used in the following components: - The `writer` field sanitizes all entered content on the backend before it is saved to the content file. - The `list` field performs the same sanitization as the `writer` field since Kirby 5.4.1 (and in backported versions since Kirby 4.9.1). - The `Kirby\Sane` class package includes higher-level classes `Sane\Html`, `Sane\Svg` and `Sane\Xml` that all rely on DOM sanitization. - These classes are in turn also used by `Sane::sanitizeFile()` and `$file->sanitizeContents()`. - Any of the mentioned methods could also be used in site or plugin code, for example in a `file.create:before` hook that cleans uploaded SVG/HTML files. Only the sanitization path (returning a cleaned document) is affected. The validation path is *not* affected by this vulnerability. Kirby's default upload protection performs validation, so malicious SVG or HTML uploads continue to be rejected. ### Impact In affected releases, `Dom::sanitize()` did not sanitize nodes that had been unwrapped from their parent node. The affected child nodes would be copied into the resulting sanitized document without being sanitized. An authenticated Panel user who can edit a `writer` or `list` field can store markup that survives sanitization and executes as JavaScript when the content is rendered, both in the Panel and on the site frontend. This allows a lower-privileged editor to run scripts in the context of higher-privileged users (for example admins) who view the content ("stored XSS"). Where a plugin or custom code cleans uploaded SVG/HTML with the `Sane` API, the same flaw leaves active content in the stored file, which executes when the file is served. ### Patches The problem has been patched in [Kirby 4.9.4](https://github.com/getkirby/kirby/releases/tag/4.9.4) and [Kirby 5.4.4](https://github.com/getkirby/kirby/releases/tag/5.4.4). Please update to one of these or a [later version](https://github.com/getkirby/kirby/releases) to fix the vulnerability. In all of the mentioned releases, `Dom::unwrap()` now *moves* the allowed children to the parent instead of cloning them, so the exact nodes remain in the document and are covered by the sanitization pass. Note that content that was passed through the sanitizer and stored as field content before the patch may contain malicious content that was not properly sanitized due to the vulnerable code. If you cannot rule out attackers under the authenticated users of a security-critical site, we advise reviewing the content for possible attacks or to re-sanitize all content of affected fields. ### Credits Thanks to Shafiq Aiman (@shafiqaimanx) for responsibly reporting the identified issue.

CVE-2026-54002 Affected Kirby Versions

2 component(s)
Fixed Versions:
4.9.45.4.4
Product / Package Ecosystem Affected Versions Fixed Version
getkirby/cms
Packagist
< 4.9.4
4.9.4
getkirby/cms
Packagist
≥ 5.0.0-alpha.1
< 5.4.4
5.4.4

References

Frequently Asked Questions

What is CVE-2026-54002?
CVE-2026-54002 is a security vulnerability in Kirby involving Cross-site scripting (XSS) from incomplete HTML/XML sanitization in `Dom::sanitize()` under CWE-87: Improper Neutralization of Alternate XSS Syntax.
Which Kirby versions are affected?
Affected versions include releases prior to 4.9.4, 5.4.4 across affected packages: getkirby/cms.
What version fixes CVE-2026-54002?
Upgrading to 4.9.4, 5.4.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is getkirby/cms affected?
Yes, getkirby/cms is affected in releases prior to 4.9.4, 5.4.4. Upgrade your dependency to 4.9.4, 5.4.4 or later.
What CWE is associated with CVE-2026-54002?
CVE-2026-54002 is classified under CWE-87: Improper Neutralization of Alternate XSS Syntax (The product does not neutralize or incorrectly neutralizes user-controlled input for alternate script syntax.).
How can I check Packagist dependencies for CVE-2026-54002?
Run the dependency tree command: 'inspect dependencies for getkirby/cms'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-wr9h-4r83-f4v6",
  "modified" : "2026-06-18T15:04:52Z",
  "published" : "2026-06-18T15:04:52Z",
  "aliases" : [ "CVE-2026-54002" ],
  "summary" : "Kirby: Cross-site scripting (XSS) from incomplete HTML/XML sanitization in `Dom::sanitize()`",
  "details" : "### TL;DR\n\nThis vulnerability affects Kirby sites and plugins that use the `writer` or `list` fields or that use `$dom->sanitize()`, `Sane::sanitize()`, `Sane\\Html::sanitize()`, `Sane\\Svg::sanitize()`, `Sane\\Xml::sanitize()`,  `Sane::sanitizeFile()` or `$file->sanitizeContents()` with untrusted input.\n\nIt was possible to inject malicious markup as children of an unknown HTML/XML tag, which would then be passed through `Dom::sanitize()` without being correctly sanitized according to the provided sanitization rules, causing a cross-site scripting (XSS) risk.\n\n**This vulnerability is of high severity for affected sites.**\n\nThe default file upload protection is *not* affected, so sites that only *validate* uploaded files are not exposed to this vulnerability. The vulnerability can only be exploited by authenticated users.\n\n----\n\n### Introduction\n\nCross-site scripting (XSS) is a type of vulnerability that allows executing any kind of JavaScript code inside the site frontend or Panel session of the same or other users. In the Panel, a harmful script can, for example, trigger requests to Kirby's API with the permissions of the victim.\n\nIn a *stored* XSS attack, the malicious payload is saved into the content data and has the potential to affect other users or site visitors.\n\nSuch vulnerabilities are 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\nA specific class of stored XSS is auto-firing, meaning the maliciously injected JavaScript code is executed by the browser when the page loads without the victim having to perform a specific action.\n\n### Affected components\n\nThe `Dom::sanitize()` method allows removing unwanted or malicious elements or attributes from DOM documents (which includes HTML, SVG or arbitrary XML data). Sanitized content is supposed to be protected against cross-site scripting (XSS) attacks by removing their impact from untrusted content input.\n\n`Dom::sanitize()` internally checks all nodes and attributes of the DOM document. It removes nodes, attributes, processing instructions, doctypes and namespaces that are not allowed according to the provided configuration. Nodes with tags that have been explicitly blocklisted are removed together with their children. Nodes with explicitly allowlisted tags are kept. If a tag is neither allowlisted nor blocklisted, nodes with that tag are unwrapped by `Dom::unwrap()` (meaning the children are kept).\n\n`Dom::sanitize()` is used in the following components:\n\n- The `writer` field sanitizes all entered content on the backend before it is saved to the content file.\n- The `list` field performs the same sanitization as the `writer` field since Kirby 5.4.1 (and in backported versions since Kirby 4.9.1).\n- The `Kirby\\Sane` class package includes higher-level classes `Sane\\Html`, `Sane\\Svg` and `Sane\\Xml` that all rely on DOM sanitization.\n- These classes are in turn also used by `Sane::sanitizeFile()` and `$file->sanitizeContents()`.\n- Any of the mentioned methods could also be used in site or plugin code, for example in a `file.create:before` hook that cleans uploaded SVG/HTML files.\n\nOnly the sanitization path (returning a cleaned document) is affected. The validation path is *not* affected by this vulnerability. Kirby's default upload protection performs validation, so malicious SVG or HTML uploads continue to be rejected.\n\n### Impact\n\nIn affected releases, `Dom::sanitize()` did not sanitize nodes that had been unwrapped from their parent node. The affected child nodes would be copied into the resulting sanitized document without being sanitized.\n\nAn authenticated Panel user who can edit a `writer` or `list` field can store markup that survives sanitization and executes as JavaScript when the content is rendered, both in the Panel and on the site frontend. This allows a lower-privileged editor to run scripts in the context of higher-privileged users (for example admins) who view the content (\"stored XSS\"). Where a plugin or custom code cleans uploaded SVG/HTML with the `Sane` API, the same flaw leaves active content in the stored file, which executes when the file is served.\n\n### Patches\n\nThe problem has been patched in [Kirby 4.9.4](https://github.com/getkirby/kirby/releases/tag/4.9.4) and [Kirby 5.4.4](https://github.com/getkirby/kirby/releases/tag/5.4.4). Please update to one of these or a [later version](https://github.com/getkirby/kirby/releases) to fix the vulnerability.\n\nIn all of the mentioned releases, `Dom::unwrap()` now *moves* the allowed children to the parent instead of cloning them, so the exact nodes remain in the document and are covered by the sanitization pass.\n\nNote that content that was passed through the sanitizer and stored as field content before the patch may contain malicious content that was not properly sanitized due to the vulnerable code. If you cannot rule out attackers under the authenticated users of a security-critical site, we advise reviewing the content for possible attacks or to re-sanitize all content of affected fields.\n\n### Credits\n\nThanks to Shafiq Aiman (@shafiqaimanx) for responsibly reporting the identified issue.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "getkirby/cms"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.9.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 4.9.3"
    }
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "getkirby/cms"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0-alpha.1"
      }, {
        "fixed" : "5.4.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.4.3"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/getkirby/kirby/security/advisories/GHSA-wr9h-4r83-f4v6"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/getkirby/kirby"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/getkirby/kirby/releases/tag/4.9.4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/getkirby/kirby/releases/tag/5.4.4"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79", "CWE-87" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-18T15:04:52Z",
    "nvd_published_at" : null
  }
}