CVE-2023-47115: Cross-site Scripting Vulnerability on Avatar Upload

CVE-2023-47115 · Severity: low · CVSS 3.1 · Published 2024-01-23

Label Studio is an a popular open source data labeling tool. Versions prior to 1.9.2 have a cross-site scripting (XSS) vulnerability that could be exploited when an authenticated user uploads a crafted image file for their avatar that gets rendered as a HTML file on the website. Executing arbitrary JavaScript could result in an attacker performing malicious actions on Label Studio users if they visit the crafted avatar image. For an example, an attacker can craft a JavaScript payload that adds a new Django Super Administrator user if a Django administrator visits the image.

The file `users/functions.py` lines 18-49 show that the only verification check is that the file is an image by extracting the dimensions from the file. Label Studio serves avatar images using Django's built-in `serve` view, which is not secure for production use according to Django's documentation. The issue with the Django `serve` view is that it determines the `Content-Type` of the response by the file extension in the URL path. Therefore, an attacker can upload an image that contains malicious HTML code and name the file with a `.html` extension to be rendered as a HTML page. The only file extension validation is performed on the client-side, which can be easily bypassed.

Version 1.9.2 fixes this issue. Other remediation strategies include validating the file extension on the server side, not in client-side code; removing the use of Django's `serve` view and implement a secure controller for viewing uploaded avatar images; saving file content in the database rather than on the filesystem to mitigate against other file related vulnerabilities; and avoiding trusting user controlled inputs.

Technologies: label-studio (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2023-47115 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2023-47115 being exploited in the wild.
How severe is CVE-2023-47115?
Low severity, with a CVSS score of 3.1, published 23 January 2024.
Which products and versions are affected?
label-studio (PyPI) ECOSYSTEM:introduced=0,fixed=1.9.2, GIT:introduced=0,fixed=a7a71e594f32ec4af8f3f800d5ccb8662e275da3|ECOSYSTEM:introduced=0,fixed=1.9.2.
Is there a fix for CVE-2023-47115?
Yes. label-studio (PyPI): upgrade to 1.9.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
Am I affected by CVE-2023-47115?
Check whether you run label-studio (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • label-studio (PyPI): upgrade to 1.9.2 or later
    pip install "label-studio>=1.9.2"

Affected products

  • label-studio (PyPI) ECOSYSTEM:introduced=0,fixed=1.9.2, GIT:introduced=0,fixed=a7a71e594f32ec4af8f3f800d5ccb8662e275da3|ECOSYSTEM:introduced=0,fixed=1.9.2

Identifiers

  • CVE-2023-47115
  • GHSA-q68h-xwq5-mm7x
  • PYSEC-2024-126

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.