CVE-2023-32686: Kiwitcms Cross-Site Scripting Vulnerability
MODERATECVE-2023-32686 is a MODERATE (CVSS 5.4) cross-site scripting vulnerability (CWE-434: Unrestricted Upload of File with Dangerous Type) affecting Kiwitcms libraries in the PyPI ecosystem. The issue involves kiwitcms vulnerable to stored xss via unrestricted files upload. Remediation is available by upgrading affected packages to version 12.3.
CVE-2023-32686 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:R/S:C/C:L/I:L/A:N).
How to Fix CVE-2023-32686
To remediate this vulnerability, upgrade all affected Kiwitcms dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install kiwitcms>=12.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show kiwitcms
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2023-32686, inspect your installed packages using pip:
pip show kiwitcms
Analyze the terminal output to locate any version of Kiwitcms in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 12.3), your application is affected.
Note: The pip show kiwitcms command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-434: Unrestricted Upload of File with Dangerous Type, where the product allows the upload or transfer of dangerous file types that are automatically processed within its environment. In Kiwitcms, 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-32686 Affected Kiwitcms Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
kiwitcms
|
PyPI |
< 12.3
|
12.3
|
References
Frequently Asked Questions
What is CVE-2023-32686?
Which Kiwitcms versions are affected?
What version fixes CVE-2023-32686?
Is kiwitcms affected?
What is the CVSS score of CVE-2023-32686?
What CWE is associated with CVE-2023-32686?
How can I check PyPI dependencies for CVE-2023-32686?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-x7c2-7wvg-jpx7",
"modified" : "2023-06-02T22:22:57Z",
"published" : "2023-05-22T19:39:46Z",
"aliases" : [ "CVE-2023-32686" ],
"summary" : "kiwitcms vulnerable to stored XSS via unrestricted files upload",
"details" : "### Impact\nKiwi TCMS allows users to upload attachments to test plans, test cases, etc. Earlier versions of Kiwi TCMS had introduced upload validators in order to prevent potentially dangerous files from being uploaded, see [GHSA-fwcf-753v-fgcj](https://github.com/kiwitcms/Kiwi/security/advisories/GHSA-fwcf-753v-fgcj) and Content-Security-Policy definition to prevent cross-site-scripting attacks, see [GHSA-2wcr-87wf-cf9j](https://github.com/kiwitcms/Kiwi/security/advisories/GHSA-2wcr-87wf-cf9j).\n\nThe upload validation checks were not robust enough which left the possibility of an attacker to circumvent them and upload a potentially dangerous file. Exploting this flaw a combination of files could be uploaded so that they work together to circumvent the existing Content-Security-Policy and allow execution of arbitrary JavaScript in the browser.\n\n### Patches\n- File upload validation code has been improved\n- Kiwi TCMS will now force `Content-Type: text/plain` when serving uploaded files\n\n### Workarounds\n\n1) Force the Content-Type header via a custom Django middleware, see `ExtraHeadersMiddleware` in https://github.com/kiwitcms/Kiwi/blob/master/tcms/core/middleware.py#L23 and/or\n2) Force the Content-Type header via Nginx overrides, see `location /uploads/` in https://github.com/kiwitcms/Kiwi/blob/master/etc/nginx.conf\n\n### References\nDisclosed by [Antonio Spataro](https://huntr.dev/bounties/db75275f-8bcd-482b-ae12-feff660d4794) and [ek1ng](https://huntr.dev/bounties/46d5b535-bdff-4b98-8691-a907591fcf10/). Additional credits to [Ahmed Rabeaa Mosa](https://huntr.dev/bounties/cbc2676a-90ff-457f-9cdc-2a7981f960f3/).\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "kiwitcms"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "12.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/kiwitcms/Kiwi/security/advisories/GHSA-2wcr-87wf-cf9j"
}, {
"type" : "WEB",
"url" : "https://github.com/kiwitcms/Kiwi/security/advisories/GHSA-fwcf-753v-fgcj"
}, {
"type" : "WEB",
"url" : "https://github.com/kiwitcms/Kiwi/security/advisories/GHSA-x7c2-7wvg-jpx7"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-32686"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/kiwitcms/Kiwi"
}, {
"type" : "WEB",
"url" : "https://kiwitcms.org/blog/kiwi-tcms-team/2023/05/22/kiwi-tcms-123"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-434", "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-05-22T19:39:46Z",
"nvd_published_at" : "2023-05-27T04:15:25Z"
}
}