CVE-2024-23633 Label Studio XSS Vulnerability on Data Import

Medium 4.7 Published Updated

Attackers can execute arbitrary JavaScript via malicious HTML imports, potentially escalating privileges to administrator.

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

What is CVE-2024-23633?

CVE-2024-23633 is a medium-severity cross-site scripting vulnerability in HumanSignal label-studio, published on 23 Jan 2024. 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

Label Studio, an open source data labeling tool had a remote import feature allowed users to import data from a remote web source, that was downloaded and could be viewed on the website. Prior to version 1.10.1, this feature could had been abused to download a HTML file that executed malicious JavaScript code in the context of the Label Studio 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.

`data_import/uploader.py` lines 125C5 through 146 showed that if a URL passed the server side request forgery verification checks, the contents of the file would be downloaded using the filename in the URL. The downloaded file path could then be retrieved by sending a request to `/api/projects/{project_id}/file-uploads?ids=[{download_id}]` where `{project_id}` was the ID of the project and `{download_id}` was the ID of the downloaded file. Once the downloaded file path was retrieved by the previous API endpoint, `data_import/api.py`lines 595C1 through 616C62 demonstrated that the `Content-Type` of the response was determined by the file extension, since `mimetypes.guess_type` guesses the `Content-Type` based on the file extension. Since the `Content-Type` was determined by the file extension of the downloaded file, an attacker could import in a `.html` file that would execute JavaScript when visited.

Version 1.10.1 contains a patch for this issue. Other remediation strategies are also available. For all user provided files that are downloaded by Label Studio, set the `Content-Security-Policy: sandbox;` response header when viewed on the site. The `sandbox` directive restricts a page's actions to prevent popups, execution of plugins and scripts and enforces a `same-origin` policy. Alternatively, restrict the allowed file extensions that may be downloaded.

Weakness: CWE-79

Which versions are affected by CVE-2024-23633?

3 open source packages ship an affected version, including label-studio. It affects 1 product.

PackageAffectedFixed in
label-studio PyPIAll versions1.10.1
label-studio PyPIAll versions1.10.1
label-studio PyPIAll versions1.10.1

Products include Humansignal Label Studio.

How do I fix CVE-2024-23633?

Upgrade label-studio to 1.10.1 or later.

Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.

Is CVE-2024-23633 being exploited?

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

Sources

Also known as GHSA-fq23-g58m-799r, PYSEC-2024-128.

Is CVE-2024-23633 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free