HumanSignal / HumanSignal/label-studio-ml-backend

Vulnerability in load Function: CWE - 502 Deserialization of Untrusted Data in torch.load Usage

Open
#765 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.1k
Forks
490
Avg merge
1d 14h
Merged PRs (30d)
3

Description

### Description
The function `load` in the given code is vulnerable to CWE - 502: Deserialization of Untrusted Data. It uses `torch.load` to deserialize data from the specified `path` without any validation. When `torch.load` is used to load malicious pickle data, arbitrary code can be executed during the deserialization process. This is because pickle data can contain executable code, and if the data is untrusted, it can lead to serious security risks such as remote code execution on the system running this code.

https://github.com/HumanSignal/label-studio-ml-backend/blob/9fb7f4aa186612806af2becfb621f6ed8d9fdbaf/label_studio_ml/examples/yolo/utils/neural_nets.py#L97

### Exploit
An attacker can craft malicious pickle data and trick the application into loading this data using the vulnerable `load` function. For example, the attacker can create a malicious `.pt` file that contains code to perform actions like stealing sensitive information, modifying system files, or launching a denial - of - service attack. Once the application calls the `load` function with the path to this malicious file, the code embedded in the pickle data will be executed during the deserialization process.

### Impacted
All versions of the code using the `load` function in this vulnerable way are impacted. Any call to the `load` function with an untrusted `path` can potentially lead to the execution of arbitrary code, posing a significant security threat to the system.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.