kiwitcms vulnerable to stored cross-site scripting via unrestricted file upload
Kiwi TCMS allowed users to upload attachments, and the file upload validation could be bypassed to upload a dangerous file that executes arbitrary JavaScript in the browser. Additionally, Nginx's proxy_pass directive stripped some headers, negating protections when served behind a reverse proxy.
kiwitcms/kiwi
Originally disclosed on huntr
Impact
Kiwi 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 and Content-Security-Policy definition to prevent cross-site-scripting attacks.
The upload validation checks were not 100% robust which left the possibility to circumvent them and upload a potentially dangerous file which allows execution of arbitrary JavaScript in the browser. Additionally we've discovered that Nginx's proxy_pass directive will strip some headers negating protections built into Kiwi TCMS when served behind a reverse proxy.
Patches
- Improved file upload validation code
- Updated Nginx reverse proxy configuration for *.tenant.kiwitcms.org
Workarounds
If serving Kiwi TCMS behind a reverse proxy make sure that additional header values are still passed to the client browser. If they aren't redefine them inside the proxy configuration. See etc/nginx.conf#L66-L68 and etc/nginx.conf#L87
References
Disclosed by M Nadeem Qazi.
From the GitHub Advisory Database (GHSA-2fqm-m4r2-fh98, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the file upload validation was incomplete and did not block all dangerous file types, and the reverse proxy configuration stripped security headers.
Impact
An attacker could upload a file that executes arbitrary JavaScript in a victim's browser, and the proxy header stripping could weaken protections, though the text does not specify the exact impact.
What the attacker needed
Ability to upload attachments; victim opens the uploaded file; served behind a reverse proxy (for header issue)
The fix
The file upload validation was improved and the Nginx reverse proxy configuration was updated to pass additional header values.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Kiwi TCMS lets users attach files to test plans and cases. The checks that decide which files are safe were not strong enough, so someone could upload a file that runs JavaScript when opened. Also, when Kiwi TCMS sits behind a proxy server, that proxy removed some security headers, making the problem worse.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.