# CVE-2023-36809: Kiwi TCMS's misconfigured HTTP headers allow stored XSS execution with Firefox

> Attackers can execute stored XSS via uploaded attachments due to misconfigured HTTP headers and insufficient validation in Kiwi TCMS.

- **Severity:** High 8.1 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 5 Jul 2023
- **Updated:** 24 Oct 2024
- **Also known as:** GHSA-jpgw-2r9m-8qfw, PYSEC-2026-1499

## What is CVE-2023-36809?

CVE-2023-36809 is a high-severity cross-site scripting vulnerability in kiwitcms Kiwi, published on 5 Jul 2023. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Kiwi TCMS, an open source test management system allows users to upload attachments to test plans, test cases, etc. Versions of Kiwi TCMS prior to 12.5 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 had been found to require additional sanitation and improvements. Version 12.5 fixes this vulnerability with updated Nginx content type configuration, improved file upload validation code to prevent more potentially dangerous uploads, and Sanitization of test plan names used in the `tree_view_html()` function.

Weakness: CWE-79 (Improper Neutralization of Input During Web Page Generation), CWE-434 (Unrestricted Upload of File with Dangerous Type)

## Which versions are affected by CVE-2023-36809?

3 open source packages ship an affected version, including kiwitcms. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `kiwitcms` | PyPI | All versions | 12.5 |
| `kiwitcms` | PyPI | All versions | 12.5 |
| `kiwitcms` | PyPI | All versions | 12.5 |

Products: Kiwitcms Kiwi Tcms.

## How do I fix CVE-2023-36809?

Upgrade kiwitcms to 12.5 or later.

## Is CVE-2023-36809 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-36809 exists.

## Other vulnerabilities in kiwitcms Kiwi

- [CVE-2023-30628](https://insights.sbomify.com/CVE-2023-30628/): Kiwi TCMS has command injection vulnerability in changelog.yml CI workflow (high 8.8)
- [CVE-2023-33977](https://insights.sbomify.com/CVE-2023-33977/): Stored cross site scripting (XSS) via unrestricted file upload in Kiwi TCMS (high 8.1)
- [CVE-2023-32686](https://insights.sbomify.com/CVE-2023-32686/): kiwitcms vulnerable to stored XSS via unrestricted files upload (high 8.1)
- [CVE-2023-30613](https://insights.sbomify.com/CVE-2023-30613/): Kiwi TCMS unrestricted file upload vulnerability (high 8.1)
- [CVE-2023-27489](https://insights.sbomify.com/CVE-2023-27489/): Stored cross site scripting via SVG file upload in Kiwi TCMS (high 7.6)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-36809 and fix it if it is affected.

What it is: CVE-2023-36809 is a high-severity cross-site scripting vulnerability in kiwitcms Kiwi, published on 5 Jul 2023. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-36809 exists.

Affected packages and fixed versions:
- kiwitcms (PyPI): affected all versions; fixed in 12.5
- kiwitcms (PyPI): affected all versions; fixed in 12.5
- kiwitcms (PyPI): affected all versions; fixed in 12.5

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-36809/ (Markdown: https://insights.sbomify.com/CVE-2023-36809/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-36809
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-36809
- OSV: https://osv.dev/vulnerability/CVE-2023-36809

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-36809/
Summaries are generated and may contain mistakes; the official description above is the record.
