Tóm tắt nhanh
- CVE-2020-5252 là lỗ hổng mức TRUNG BÌNH (CVSS 4.1) ảnh hưởng safety, safety (pyup).
- Xác suất bị khai thác trong 30 ngày tới (EPSS): 0.37%, cao hơn 30.6% các lỗ hổng khác.
- Cách xử lý: cập nhật lên 1.8.7, 1.9.0 hoặc mới hơn.
| Gói / sản phẩm | Phiên bản bị ảnh hưởng | Phiên bản đã vá |
|---|
| safety PyPI | < 1.8.7< 1.9.0
| 1.8.71.9.0
|
| safety | ≤ 1.8.6
| Chưa có bản vá |
Mô tả
Python Auditing Vulnerability
Demonstrates how a malicious package can insert a load-time poison pill to avoid detection by tools like Safety.
Tools that are designed to find vulnerable packages can not ever run in the same python environment that they are trying to protect.
Usage
Install safety, insecure-package, and this package with pip in the same python environment. Order doesn't matter.
- pip install safety
- pip install insecure-package
- pip install dist/malicious-0.1-py3-none-any.whl
Run the check
safety check
You should see both Running my modified safety.check and that insecure-package is not listed in the results!
How it Works
Everything in Python is mutable. The trick is getting some code to run at interpreter load time in order to do some patching.
- When you install this package, the
setup.py settings installs a malicious.pth file to your site-packages directory.
- The
malicious.pth file gets loaded anytime Python starts, which in turn imports our malicious package.
- The
malicious/__init__.py patches the safety library with a custom function to avoid detection.
Mô tả của NVD
The command-line "safety" package for Python has a potential security issue. There are two Python characteristics that allow malicious code to “poison-pill” command-line Safety package detection routines by disguising, or obfuscating, other malicious or non-secure packages. This vulnerability is considered to be of low severity because the attack makes use of an existing Python condition, not the Safety tool itself. This can happen if: You are running Safety in a Python environment that you don’t trust. You are running Safety from the same Python environment where you have your dependencies installed. Dependency packages are being installed arbitrarily or without proper verification. Users can mitigate this issue by doing any of the following: Perform a static analysis by installing Docker and running the Safety Docker image: $ docker run --rm -it pyupio/safety check -r requirements.txt Run Safety against a static dependencies list, such as the requirements.txt file, in a separate, clean Python environment. Run Safety from a Continuous Integration pipeline. Use PyUp.io, which runs Safety in a controlled environment and checks Python for dependencies without any need to install them. Use PyUp's Online Requirements Checker.
Bạn đang dùng một trong các sản phẩm này? Quét site để biết có đang lộ phiên bản có lỗ hổng không.
Quét site miễn phí