CVE-2023-38491: Getkirby/cms Cross-Site Scripting Vulnerability
MODERATECVE-2023-38491 is a MODERATE (CVSS 5.7) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Getkirby/cms libraries in the Packagist ecosystem. The issue involves cross-site scripting (xss) from mime type auto-detection of uploaded files. Remediation is available by upgrading affected packages to version 3.5.8.3, 3.6.6.3, 3.7.5.2, 3.8.4.1, 3.9.6.
CVE-2023-38491 at a Glance
Security Impact
CVSS: 5.7
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:R/S:U/C:H/I:N/A:N).
How to Fix CVE-2023-38491
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.3
Upgrade getkirby/cms to 3.6.6.3
Upgrade getkirby/cms to 3.7.5.2
Upgrade getkirby/cms to 3.8.4.1
Upgrade getkirby/cms to 3.9.6
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-2023-38491, 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.3), 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. 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-2023-38491 Affected Getkirby/cms Versions
5 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
getkirby/cms
|
Packagist |
< 3.5.8.3
|
3.5.8.3
|
|
getkirby/cms
|
Packagist |
≥ 3.6.0
< 3.6.6.3
|
3.6.6.3
|
|
getkirby/cms
|
Packagist |
≥ 3.7.0
< 3.7.5.2
|
3.7.5.2
|
|
getkirby/cms
|
Packagist |
≥ 3.8.0
< 3.8.4.1
|
3.8.4.1
|
|
getkirby/cms
|
Packagist |
≥ 3.9.0
< 3.9.6
|
3.9.6
|
References
Frequently Asked Questions
What is CVE-2023-38491?
Which Getkirby/cms versions are affected?
What version fixes CVE-2023-38491?
Is getkirby/cms affected?
What is the CVSS score of CVE-2023-38491?
What CWE is associated with CVE-2023-38491?
How can I check Packagist dependencies for CVE-2023-38491?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-8fv7-wq38-f5c9",
"modified" : "2023-07-28T15:34:36Z",
"published" : "2023-07-28T15:34:36Z",
"aliases" : [ "CVE-2023-38491" ],
"summary" : "Cross-site scripting (XSS) from MIME type auto-detection of uploaded files",
"details" : "### TL;DR\n\nThis vulnerability affects all Kirby sites that might have potential attackers in the group of authenticated Panel users or that allow external visitors to upload an arbitrary file to the content folder.\n\nYour Kirby sites are *not* affected if they don't allow file uploads for untrusted users or visitors or if the file extensions of uploaded files are limited to a fixed safe list.\n\nThe attack requires user interaction by another user or visitor and *cannot* be automated.\n\n----\n\n### Introduction\n\nCross-site scripting (XSS) is a type of vulnerability that allows to execute any kind of JavaScript code inside the 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\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\n### Impact\n\nAn editor with write access to the Kirby Panel could upload a file with an unknown file extension like `.xyz` that contains HTML code including harmful content like `<script>` tags. The direct link to that file could be sent to other users or visitors of the site. If the victim opened that link in a browser where they are logged in to Kirby and the file had not been opened by anyone since the upload, Kirby would serve the file with an incorrect MIME type of `text/html`. The browser would then run the script, which could for example trigger requests to Kirby's API with the permissions of the victim.\n\nThe issue was caused by the underlying `Kirby\\Http\\Response::file()` method, which didn't have an explicit fallback if the MIME type could not be determined from the file extension. If you use this method in site or plugin code, these uses may be affected by the same vulnerability.\n\n### Patches\n\nThe problem has been patched in [Kirby 3.5.8.3](https://github.com/getkirby/kirby/releases/tag/3.5.8.3), [Kirby 3.6.6.3](https://github.com/getkirby/kirby/releases/tag/3.6.6.3), [Kirby 3.7.5.2](https://github.com/getkirby/kirby/releases/tag/3.7.5.2), [Kirby 3.8.4.1](https://github.com/getkirby/kirby/releases/tag/3.8.4.1) and [Kirby 3.9.6](https://github.com/getkirby/kirby/releases/tag/3.9.6). 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, we have fixed the affected method to use a fallback MIME type of `text/plain` and set the `X-Content-Type-Options: nosniff` header if the MIME type of the file is unknown.\n\n### Credits\n\nThanks to Shankar Acharya (@5hank4r) for responsibly reporting the identified issue.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "getkirby/cms"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.5.8.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "getkirby/cms"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.6.0"
}, {
"fixed" : "3.6.6.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "getkirby/cms"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.7.0"
}, {
"fixed" : "3.7.5.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "getkirby/cms"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.8.0"
}, {
"fixed" : "3.8.4.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "getkirby/cms"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.9.0"
}, {
"fixed" : "3.9.6"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/getkirby/kirby/security/advisories/GHSA-8fv7-wq38-f5c9"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-38491"
}, {
"type" : "WEB",
"url" : "https://github.com/getkirby/kirby/commit/2f06ba1c026bc91cb0702bc16b7d505642536d15"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/getkirby/kirby"
}, {
"type" : "WEB",
"url" : "https://github.com/getkirby/kirby/releases/tag/3.5.8.3"
}, {
"type" : "WEB",
"url" : "https://github.com/getkirby/kirby/releases/tag/3.6.6.3"
}, {
"type" : "WEB",
"url" : "https://github.com/getkirby/kirby/releases/tag/3.7.5.2"
}, {
"type" : "WEB",
"url" : "https://github.com/getkirby/kirby/releases/tag/3.8.4.1"
}, {
"type" : "WEB",
"url" : "https://github.com/getkirby/kirby/releases/tag/3.9.6"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-07-28T15:34:36Z",
"nvd_published_at" : "2023-07-27T16:15:10Z"
}
}