CVE-2021-32735: Getkirby/cms Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-2f2w-349x-vrqm
CVSS 7.1
CWE-80
Published
Advisory Summary

CVE-2021-32735 is a HIGH (CVSS 7.1) cross-site scripting vulnerability (CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)) affecting Getkirby/cms libraries in the Packagist ecosystem. The issue involves cross-site scripting (xss) from field and configuration text displayed in the panel. Remediation is available by upgrading affected packages to version 3.5.7.

CVE-2021-32735 at a Glance

CVE Identifier CVE-2021-32735
GHSA Identifier GHSA-2f2w-349x-vrqm
Severity HIGH
CVSS v3.1 Base Score 7.1
CWE Classification CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)
Affected Product Getkirby/cms
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 7.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2021-32735

To remediate this vulnerability, upgrade all affected Getkirby/cms 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: 3.5.7
Upgrade getkirby/cms to 3.5.7
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-2021-32735, inspect your project dependencies for Getkirby/cms:

inspect dependencies for getkirby/cms

Analyze the terminal output to locate any version of Getkirby/cms in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.5.7), 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-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS), where the product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special characters such as "<", ">", and "&" that could be interpreted as web-scripting elements when they are sent to a downstream component that processes web pages. In Getkirby/cms, 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

On Saturday, @hdodov reported that the Panel's `ListItem` component (used in the pages and files section for example) displayed HTML in page titles as it is. This could be used for cross-site scripting (XSS) attacks. We used his report as an opportunity to find and fix XSS issues related to dynamic site content throughout the Panel codebase. ### Impact Cross-site scripting (XSS) is a type of vulnerability that allows to execute any kind of JavaScript code inside the Panel session of other users. In the Panel, a harmful script can for example trigger requests to Kirby's API with the permissions of the victim. 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. Visitors without Panel access can only use this attack vector if your site allows changing site data from a frontend form (for example user self-registration or the creation of pages from a contact or other frontend form). If you validate or sanitize the provided form data, you are already protected against such attacks by external visitors. ### Patches [Kirby 3.5.7](https://github.com/getkirby/kirby/releases/tag/3.5.7) contains patches for the following issues we found during our investigation: - Some translated error and info messages contain placeholders to dynamically insert information like page titles or filenames. While the translation strings are allowed to contain HTML formatting, the dynamic data needs to be protected against XSS attacks. Kirby 3.5.7 now escapes the dynamic data. - Our `Box` component used to display information for the user supports HTML output for specific use-cases. We found out that the dialogs used in the `files`, `pages` and `users` fields as well as the `fields` section used it to display raw exception or error messages. These messages are now escaped. - The users and settings views display user and language data using the `ListItem` component that supports HTML. We now escape the dynamic data before it is passed to the `ListItem` component. - Some of our sections and fields support HTML for their `text`, `help` and/or `info` properties. This allows custom formatting from the blueprint, but also caused the original issue reported to us that allowed to inject HTML code from the content itself. Kirby 3.5.7 now escapes the default `text` displayed by the `files` and `pages` sections (filename/page title), the `files`, `pages` and `users` fields (filename/page title/username) and by query-based `checkboxes`, `radio`, `tags` and `multiselect` fields (default text depending on the used query). **Note:** Custom `text`, `help` and `info` queries in blueprints are *not* escaped in 3.5.7. We support HTML in these properties because there are valid use-cases for custom formatting. However there can still be XSS vulnerabilities depending on your use of these properties. In Kirby 3.6 we will provide a new feature that will make it much easier to control whether you want to allow HTML from query placeholders.

CVE-2021-32735 Affected Getkirby/cms Versions

1 component(s)
Fixed Versions:
3.5.7
Product / Package Ecosystem Affected Versions Fixed Version
getkirby/cms
Packagist
< 3.5.7
3.5.7

References

Frequently Asked Questions

What is CVE-2021-32735?
CVE-2021-32735 is a security vulnerability in Getkirby/cms involving Cross-site scripting (XSS) from field and configuration text displayed in the Panel under CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS).
Which Getkirby/cms versions are affected?
Affected versions include releases prior to 3.5.7 across affected packages: getkirby/cms.
What version fixes CVE-2021-32735?
Upgrading to 3.5.7 (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 3.5.7. Upgrade your dependency to 3.5.7 or later.
What is the CVSS score of CVE-2021-32735?
CVE-2021-32735 has a CVSS v3.1 base score of 7.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N.
What CWE is associated with CVE-2021-32735?
CVE-2021-32735 is classified under CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS) (The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special characters such as "<", ">", and "&" that could be interpreted as web-scripting elements when they are sent to a downstream component that processes web pages.).
How can I check Packagist dependencies for CVE-2021-32735?
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-2f2w-349x-vrqm",
  "modified" : "2023-04-14T19:24:30Z",
  "published" : "2021-07-02T19:18:43Z",
  "aliases" : [ "CVE-2021-32735" ],
  "summary" : "Cross-site scripting (XSS) from field and configuration text displayed in the Panel",
  "details" : "On Saturday, @hdodov reported that the Panel's `ListItem` component (used in the pages and files section for example) displayed HTML in page titles as it is. This could be used for cross-site scripting (XSS) attacks.\n\nWe used his report as an opportunity to find and fix XSS issues related to dynamic site content throughout the Panel codebase.\n\n### Impact\n\nCross-site scripting (XSS) is a type of vulnerability that allows to execute any kind of JavaScript code inside the Panel session of other users. In the Panel, a harmful script can for example trigger requests to Kirby's API with the permissions of the victim.\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\nVisitors without Panel access can only use this attack vector if your site allows changing site data from a frontend form (for example user self-registration or the creation of pages from a contact or other frontend form). If you validate or sanitize the provided form data, you are already protected against such attacks by external visitors.\n\n### Patches\n\n[Kirby 3.5.7](https://github.com/getkirby/kirby/releases/tag/3.5.7) contains patches for the following issues we found during our investigation:\n\n- Some translated error and info messages contain placeholders to dynamically insert information like page titles or filenames. While the translation strings are allowed to contain HTML formatting, the dynamic data needs to be protected against XSS attacks. Kirby 3.5.7 now escapes the dynamic data.\n- Our `Box` component used to display information for the user supports HTML output for specific use-cases. We found out that the dialogs used in the `files`, `pages` and `users` fields as well as the `fields` section used it to display raw exception or error messages. These messages are now escaped.\n- The users and settings views display user and language data using the `ListItem` component that supports HTML. We now escape the dynamic data before it is passed to the `ListItem` component.\n- Some of our sections and fields support HTML for their `text`, `help` and/or `info` properties. This allows custom formatting from the blueprint, but also caused the original issue reported to us that allowed to inject HTML code from the content itself. Kirby 3.5.7 now escapes the default `text` displayed by the `files` and `pages` sections (filename/page title), the `files`, `pages` and `users` fields (filename/page title/username) and by query-based `checkboxes`, `radio`, `tags` and `multiselect` fields (default text depending on the used query).\n\n**Note:** Custom `text`, `help` and `info` queries in blueprints are *not* escaped in 3.5.7. We support HTML in these properties because there are valid use-cases for custom formatting. However there can still be XSS vulnerabilities depending on your use of these properties. In Kirby 3.6 we will provide a new feature that will make it much easier to control whether you want to allow HTML from query placeholders.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "getkirby/cms"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.5.7"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 3.5.6"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/getkirby/kirby/security/advisories/GHSA-2f2w-349x-vrqm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-32735"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/getkirby/kirby/commit/f5ead62f8510158bed5baf58ca0e851875778a09"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/getkirby/kirby"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/getkirby/kirby/releases/tag/3.5.7"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-80" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-07-02T16:38:10Z",
    "nvd_published_at" : "2021-07-02T15:15:00Z"
  }
}