pysec-2024-128
Vulnerability from pysec
Published
2024-01-24 00:15
Modified
2024-11-21 14:22
Details

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.pylines 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.




{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "label-studio",
        "purl": "pkg:pypi/label-studio"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "1.10.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "0.4.1",
        "0.4.2",
        "0.4.3",
        "0.4.4",
        "0.4.4.post1",
        "0.4.4.post2",
        "0.4.5",
        "0.4.6",
        "0.4.6.post1",
        "0.4.6.post2",
        "0.4.7",
        "0.4.8",
        "0.5.0",
        "0.5.1",
        "0.6.0",
        "0.6.1",
        "0.7.0",
        "0.7.1",
        "0.7.2",
        "0.7.3",
        "0.7.4",
        "0.7.4.post0",
        "0.7.4.post1",
        "0.7.5.post1",
        "0.7.5.post2",
        "0.8.0",
        "0.8.0.post0",
        "0.8.1",
        "0.8.1.post0",
        "0.8.2",
        "0.8.2.post0",
        "0.9.0",
        "0.9.0.post2",
        "0.9.0.post3",
        "0.9.0.post4",
        "0.9.0.post5",
        "0.9.1",
        "0.9.1.post0",
        "0.9.1.post1",
        "0.9.1.post2",
        "1.0.0",
        "1.0.0.post0",
        "1.0.0.post1",
        "1.0.0.post2",
        "1.0.0.post3",
        "1.0.1",
        "1.0.2",
        "1.0.2.post0",
        "1.1.0",
        "1.1.0rc0",
        "1.1.1",
        "1.10.0",
        "1.10.0.post0",
        "1.2",
        "1.3",
        "1.3.post0",
        "1.3.post1",
        "1.4",
        "1.4.1",
        "1.4.1.post0",
        "1.4.1.post1",
        "1.5.0",
        "1.5.0.post0",
        "1.6.0",
        "1.7.0",
        "1.7.1",
        "1.7.2",
        "1.7.3",
        "1.8.0",
        "1.8.1",
        "1.8.2",
        "1.8.2.post0",
        "1.8.2.post1",
        "1.9.0",
        "1.9.1",
        "1.9.1.post0",
        "1.9.2",
        "1.9.2.post0"
      ]
    }
  ],
  "aliases": [
    "CVE-2024-23633",
    "GHSA-fq23-g58m-799r"
  ],
  "details": "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.\n\n`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.\n\nVersion 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\u0027s 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.",
  "id": "PYSEC-2024-128",
  "modified": "2024-11-21T14:22:53.406222+00:00",
  "published": "2024-01-24T00:15:00+00:00",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://github.com/HumanSignal/label-studio/security/advisories/GHSA-fq23-g58m-799r"
    },
    {
      "type": "WEB",
      "url": "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox"
    },
    {
      "type": "WEB",
      "url": "https://github.com/HumanSignal/label-studio/blob/1.9.2.post0/label_studio/data_import/api.py#L595C1-L616C62"
    },
    {
      "type": "WEB",
      "url": "https://github.com/HumanSignal/label-studio/blob/1.9.2.post0/label_studio/data_import/uploader.py#L125C5-L146"
    }
  ],
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N",
      "type": "CVSS_V3"
    }
  ]
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading...

Loading...

Loading...

Sightings

Author Source Type Date

Nomenclature

  • 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.