Command Execution Risk in scikit-learn: Untrusted File Handling Vulnerability
Summary
DEBIAN-CVE-2020-13092: scikit-learn (aka sklearn) through 0.23.0 can unserialize and execute commands from an untrusted file that is passed to the joblib.load() function, if reduce makes an os.system call. Affects scikit-learn versions 0.23.2-5 – 1.4.2+dfsg-8. No fix is published. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
scikit-learn, also known as sklearn, is a widely-used machine learning library in Python that provides simple and efficient tools for data mining and data analysis. It is built on NumPy, SciPy, and matplotlib, and is designed to be accessible to non-experts while also being flexible enough for advanced users. The library offers various algorithms for classification, regression, clustering, and dimensionality reduction. However, a vulnerability has been identified that allows for the unserialization and execution of commands from untrusted files when using the joblib.load() function, particularly if the reduce method is improperly implemented.
Vulnerability Detail
The vulnerability arises from the ability of scikit-learn (up to version 0.23.0) to unserialize data from untrusted sources through the joblib.load() function. If an attacker crafts a malicious file that includes a reduce method calling os.system, it can lead to arbitrary command execution on the host system. This poses significant security risks, especially in environments where untrusted data is processed. The issue is compounded by the fact that the joblib.load() function is documented as unsafe, placing the onus on users to ensure secure usage.
How To Fix
No fixed version is published for this vulnerability.
Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →
Workaround
As a temporary workaround, avoid using the joblib.load() function with untrusted files. If you must load data from an untrusted source, consider using safer alternatives or sanitizing the input to ensure it does not contain malicious code.
Conclusion
The vulnerability in scikit-learn poses a significant risk due to the potential for command execution from untrusted files. Users are encouraged to update to the latest version of the library and to exercise caution when handling untrusted data. Utilizing tools like Vulert can help monitor and manage vulnerabilities effectively.
See every vulnerability recorded for scikit-learn →
FAQ
scikit-learn is a Python library for machine learning that provides tools for data analysis and modeling.
The vulnerability allows for the execution of arbitrary commands through the unserialization of untrusted files using joblib.load().
You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. Check your application using the Vulert playground at Vulert Scanner.
As a workaround, avoid loading untrusted files with joblib.load() and consider sanitizing any input data.
Yes, updating scikit-learn to a version greater than 0.23.0 will patch the vulnerability.
References
Related vulnerabilities
Recent vulnerabilities recorded for scikit-learn.