CVE-2021-41258: Getkirby/cms Cross-Site Scripting Vulnerability
MODERATECVE-2021-41258 is a MODERATE (CVSS 5.4) 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 image block content in the site frontend. Remediation is available by upgrading affected packages to version 3.5.8.
CVE-2021-41258 at a Glance
Security Impact
CVSS: 5.4
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:L/I:L/A:N).
How to Fix CVE-2021-41258
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.
Upgrade getkirby/cms to 3.5.8
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-41258, 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.8), 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
CVE-2021-41258 Affected Getkirby/cms Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
getkirby/cms
|
Packagist |
≥ 3.5.0
< 3.5.8
|
3.5.8
|
References
Frequently Asked Questions
What is CVE-2021-41258?
Which Getkirby/cms versions are affected?
What version fixes CVE-2021-41258?
Is getkirby/cms affected?
What is the CVSS score of CVE-2021-41258?
What CWE is associated with CVE-2021-41258?
How can I check Packagist dependencies for CVE-2021-41258?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-cq58-r77c-5jjw",
"modified" : "2021-11-16T15:49:36Z",
"published" : "2021-11-16T17:04:41Z",
"aliases" : [ "CVE-2021-41258" ],
"summary" : "Cross-site scripting (XSS) from image block content in the site frontend",
"details" : "### Impact\n\nKirby's [blocks field](https://getkirby.com/docs/reference/panel/fields/blocks) stores structured data for each block. This data is then used in [block snippets](https://getkirby.com/docs/reference/panel/fields/blocks#block-snippets) to convert the blocks to HTML for use in your templates. We recommend to [escape HTML special characters](https://getkirby.com/docs/guide/templates/escaping) against cross-site scripting (XSS) attacks.\n\nCross-site scripting (XSS) is a type of vulnerability that allows to execute any kind of JavaScript code inside the site frontend or Panel session of other users. If the user is logged in to the Panel, a harmful script can for example trigger requests to Kirby's API with the permissions of the victim.\n\nThe default snippet for the [image block](https://getkirby.com/docs/reference/panel/blocks/image) unfortunately did not use our escaping helper. This made it possible to include malicious HTML code in the source, alt and link fields of the image block, which would then be displayed on the site frontend and executed in the browsers of site visitors and logged in users who are browsing the site.\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\nYou are *not* affected if you don't use the blocks field or specifically the image block in any of your blueprints. You are also protected if you use a custom [block snippet](https://getkirby.com/docs/reference/panel/fields/blocks#block-snippets) that either escapes the printed values or doesn't use them. The attack can only be performed by logged-in users and only surfaces in the site frontend (i.e. in your templates). The Panel itself is unaffected and will not execute JavaScript that was injected into the image block content.\n\n### Patches\n\nWe have patched the vulnerability in [Kirby 3.5.8](https://github.com/getkirby/kirby/releases/tag/3.5.8) by escaping special HTML characters in the output from the default image block snippet. Please update to this or a [later version](https://github.com/getkirby/kirby/releases/) to fix the vulnerability.\n\n### Credits\n\nThanks to Azrul Ikhwan Zulkifli (@azrultech) from BAE Systems AI Vulnerability Research Team for responsibly reporting the identified issue.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "getkirby/cms"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.5.0"
}, {
"fixed" : "3.5.8"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/getkirby/kirby/security/advisories/GHSA-cq58-r77c-5jjw"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-41258"
}, {
"type" : "WEB",
"url" : "https://github.com/getkirby/kirby/pull/3510"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/getkirby/kirby"
}, {
"type" : "WEB",
"url" : "https://github.com/getkirby/kirby/releases/tag/3.5.8"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79", "CWE-80" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-11-16T15:49:36Z",
"nvd_published_at" : "2021-11-16T18:15:00Z"
}
}