ghsa-wpq5-3366-mqw4
Vulnerability from github
Description
Label Studio's /projects/upload-example
endpoint allows injection of arbitrary HTML through a GET
request with an appropriately crafted label_config
query parameter. By crafting a specially formatted XML label config with inline task data containing malicious HTML/JavaScript, an attacker can achieve Cross-Site Scripting (XSS). While the application has a Content Security Policy (CSP), it is only set in report-only mode, making it ineffective at preventing script execution.
The vulnerability exists because the upload-example endpoint renders user-provided HTML content without proper sanitization on a GET request. This allows attackers to inject and execute arbitrary JavaScript in victims' browsers by getting them to visit a maliciously crafted URL.
This is considered vulnerable because it enables attackers to execute JavaScript in victims' contexts, potentially allowing theft of sensitive data, session hijacking, or other malicious actions.
Steps to reproduce
- Create a malicious label config that includes an XSS payload in embedded task data:
xml
<View><!-- {"data": {"text": "<div><img src=x
onerror=eval(atob(`YWxlcnQoIlhTUyIp`))></div>"}} --><HyperText name="text"
value="$text"/></View>
-
URL encode the payload and access the following URL:
-
http://app/projects/upload-example/?label_config=%3CView%3E%3C!--%20{%22data%22:%20{%22text%22:%20%22%3Cdiv%3E%3Cimg%20src=x%20onerror=eval(atob(
YWxlcnQoIlhTUyIp
))%3E%3C/div%3E%22}}%20--%3E%3CHyperText%20name=%22text%22%20value=%22$text%22/%3E%3C/View%3E
When executed, the payload causes the application to render an HTML page containing an img tag that fails to load, triggering the onerror event handler which executes base64-decoded JavaScript, demonstrating successful XSS execution in the victim's browser.
Mitigations
- Enable the Content Security Policy in enforcement mode instead of report-only mode to actively block unauthorized script execution
- Deprecate the
GET
behavior at theexample-config
endpoint since it's not used
Impact
The vulnerability requires no special privileges and can be exploited by getting a victim to visit a crafted URL. The impact is high as it allows arbitrary JavaScript execution in victims' browsers, potentially exposing sensitive data or enabling account takeover through session theft.
{ "affected": [ { "package": { "ecosystem": "PyPI", "name": "label-studio" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "1.16.0" } ], "type": "ECOSYSTEM" } ] } ], "aliases": [ "CVE-2025-25296" ], "database_specific": { "cwe_ids": [ "CWE-79" ], "github_reviewed": true, "github_reviewed_at": "2025-02-14T15:23:03Z", "nvd_published_at": "2025-02-14T20:15:36Z", "severity": "MODERATE" }, "details": "## Description\nLabel Studio\u0027s `/projects/upload-example` endpoint allows injection of arbitrary HTML through a `GET` request with an appropriately crafted `label_config` query parameter. By crafting a specially formatted XML label config with inline task data containing malicious HTML/JavaScript, an attacker can achieve Cross-Site Scripting (XSS). While the application has a Content Security Policy (CSP), it is only set in report-only mode, making it ineffective at preventing script execution.\n\nThe vulnerability exists because the upload-example endpoint renders user-provided HTML content without proper sanitization on a GET request. This allows attackers to inject and execute arbitrary JavaScript in victims\u0027 browsers by getting them to visit a maliciously crafted URL.\n\nThis is considered vulnerable because it enables attackers to execute JavaScript in victims\u0027 contexts, potentially allowing theft of sensitive data, session hijacking, or other malicious actions.\n\n## Steps to reproduce\n1. Create a malicious label config that includes an XSS payload in embedded task data:\n\n```xml\n\u003cView\u003e\u003c!-- {\"data\": {\"text\": \"\u003cdiv\u003e\u003cimg src=x\nonerror=eval(atob(`YWxlcnQoIlhTUyIp`))\u003e\u003c/div\u003e\"}} --\u003e\u003cHyperText name=\"text\"\nvalue=\"$text\"/\u003e\u003c/View\u003e\n```\n\n\n2. URL encode the payload and access the following URL:\n\n- http://app/projects/upload-example/?label_config=%3CView%3E%3C!--%20{%22data%22:%20{%22text%22:%20%22%3Cdiv%3E%3Cimg%20src=x%20onerror=eval(atob(`YWxlcnQoIlhTUyIp`))%3E%3C/div%3E%22}}%20--%3E%3CHyperText%20name=%22text%22%20value=%22$text%22/%3E%3C/View%3E\n\nWhen executed, the payload causes the application to render an HTML page containing an img tag that fails to load, triggering the onerror event handler which executes base64-decoded JavaScript, demonstrating successful XSS execution in the victim\u0027s browser.\n \n## Mitigations\n- Enable the Content Security Policy in enforcement mode instead of report-only mode to actively block unauthorized script execution\n- Deprecate the `GET` behavior at the `example-config` endpoint since it\u0027s not used \n\n## Impact\nThe vulnerability requires no special privileges and can be exploited by getting a victim to visit a crafted URL. The impact is high as it allows arbitrary JavaScript execution in victims\u0027 browsers, potentially exposing sensitive data or enabling account takeover through session theft.", "id": "GHSA-wpq5-3366-mqw4", "modified": "2025-02-14T22:18:12Z", "published": "2025-02-14T15:23:03Z", "references": [ { "type": "WEB", "url": "https://github.com/HumanSignal/label-studio/security/advisories/GHSA-wpq5-3366-mqw4" }, { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-25296" }, { "type": "WEB", "url": "https://github.com/HumanSignal/label-studio/commit/8cf6958e1e27ef6a03ed287e674470975d340885" }, { "type": "PACKAGE", "url": "https://github.com/HumanSignal/label-studio" } ], "schema_version": "1.4.0", "severity": [ { "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "type": "CVSS_V3" } ], "summary": "Label Studio allows Cross-Site Scripting (XSS) via GET request to `/projects/upload-example` endpoint" }
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.