CVE-2023-36809: Kiwitcms Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-jpgw-2r9m-8qfw
CVSS 8.1
CWE-434 CWE-79
Published
Advisory Summary

CVE-2023-36809 is a HIGH (CVSS 8.1) cross-site scripting vulnerability (CWE-434: Unrestricted Upload of File with Dangerous Type) affecting Kiwitcms libraries in the PyPI ecosystem. The issue involves kiwi tcms's misconfigured http headers allow stored xss execution with firefox. Remediation is available by upgrading affected packages to version 12.5.

CVE-2023-36809 at a Glance

CVE Identifier CVE-2023-36809
GHSA Identifier GHSA-jpgw-2r9m-8qfw
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-434: Unrestricted Upload of File with Dangerous Type
Affected Product Kiwitcms
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.1

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

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

How to Fix CVE-2023-36809

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.

kiwitcms fixed: 12.5
pip install kiwitcms>=12.5
Verify Direct and Transitive Dependencies

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-36809, 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.5), 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

### Impact Kiwi TCMS allows users to upload attachments to test plans, test cases, etc. Earlier versions of Kiwi TCMS had introduced changes which were meant to serve all uploaded files as plain text in order to prevent browsers from executing potentially dangerous files when such files are accessed directly! The previous Nginx configuration was incorrect allowing certain browsers like Firefox to ignore the `Content-Type: text/plain` header on some occasions thus allowing potentially dangerous scripts to be executed. Additionally file upload validators and parts of the HTML rendering code have been found to require additional sanitation and improvements. ### Patches - Updated Nginx content type configuration - Improved file upload validation code to prevent more potentially dangerous uploads - Sanitization of test plan names used in the `tree_view_html()` function ### References Disclosed by [M Nadeem Qazi](https://huntr.dev/bounties/511489dd-ba38-4806-9029-b28ab2830aa8/) and [Mahshooq Zubair](https://huntr.dev/bounties/c6eeb346-fa99-4d41-bc40-b68f8d689223/).

CVE-2023-36809 Affected Kiwitcms Versions

1 component(s)
Fixed Versions:
12.5
Product / Package Ecosystem Affected Versions Fixed Version
kiwitcms
PyPI
< 12.5
12.5

References

Frequently Asked Questions

What is CVE-2023-36809?
CVE-2023-36809 is a security vulnerability in Kiwitcms involving Kiwi TCMS's misconfigured HTTP headers allow stored XSS execution with Firefox under CWE-434: Unrestricted Upload of File with Dangerous Type.
Which Kiwitcms versions are affected?
Affected versions include releases prior to 12.5 across affected packages: kiwitcms.
What version fixes CVE-2023-36809?
Upgrading to 12.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is kiwitcms affected?
Yes, kiwitcms is affected in releases prior to 12.5. Upgrade your dependency to 12.5 or later.
What is the CVSS score of CVE-2023-36809?
CVE-2023-36809 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2023-36809?
CVE-2023-36809 is classified under CWE-434: Unrestricted Upload of File with Dangerous Type (The product allows the upload or transfer of dangerous file types that are automatically processed within its environment.).
How can I check PyPI dependencies for CVE-2023-36809?
Run the dependency tree command: 'pip show kiwitcms'. 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-jpgw-2r9m-8qfw",
  "modified" : "2023-07-05T22:40:59Z",
  "published" : "2023-07-05T22:40:59Z",
  "aliases" : [ "CVE-2023-36809" ],
  "summary" : "Kiwi TCMS's misconfigured HTTP headers allow stored XSS execution with Firefox",
  "details" : "### Impact\n\nKiwi TCMS allows users to upload attachments to test plans, test cases, etc. Earlier versions of Kiwi TCMS had introduced\nchanges which were meant to serve all uploaded files as plain text in order to prevent browsers from executing potentially dangerous files when such files are accessed directly! \n\nThe previous Nginx configuration was incorrect allowing certain browsers like Firefox to ignore the `Content-Type: text/plain` header on some occasions thus allowing potentially dangerous scripts to be executed. \n\nAdditionally file upload validators and parts of the HTML rendering code have been found to require additional sanitation and improvements.\n\n### Patches\n\n- Updated Nginx content type configuration\n- Improved file upload validation code to prevent more potentially dangerous uploads\n- Sanitization of test plan names used in the `tree_view_html()` function\n\n### References\n\nDisclosed by [M Nadeem Qazi](https://huntr.dev/bounties/511489dd-ba38-4806-9029-b28ab2830aa8/) and\n[Mahshooq Zubair](https://huntr.dev/bounties/c6eeb346-fa99-4d41-bc40-b68f8d689223/).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "kiwitcms"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "12.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/kiwitcms/Kiwi/security/advisories/GHSA-jpgw-2r9m-8qfw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-36809"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/kiwitcms/kiwi/commit/195ea53eaaf360c19227c864cc0fe58910032c3c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/kiwitcms/kiwi/commit/ffb00450be52fe11a82a2507632c2328cae4ec9d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/kiwitcms/Kiwi"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.dev/bounties/511489dd-ba38-4806-9029-b28ab2830aa8"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.dev/bounties/c6eeb346-fa99-4d41-bc40-b68f8d689223"
  }, {
    "type" : "WEB",
    "url" : "https://kiwitcms.org/blog/kiwi-tcms-team/2023/07/04/kiwi-tcms-125"
  }, {
    "type" : "WEB",
    "url" : "https://www.github.com/kiwitcms/kiwi/commit/195ea53eaaf360c19227c864cc0fe58910032c3c"
  }, {
    "type" : "WEB",
    "url" : "https://www.github.com/kiwitcms/kiwi/commit/ffb00450be52fe11a82a2507632c2328cae4ec9d"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-434", "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-07-05T22:40:59Z",
    "nvd_published_at" : "2023-07-05T22:15:09Z"
  }
}