CVE-2020-5252
Malicious package may avoid detection in python auditing
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.
Attack profile
How easy it is to exploit
- Attack vector
- Local
- Complexity
- High
- Privileges needed
- High
- User interaction
- Required
What an attacker can affect
- Confidentiality
- None
- Integrity
- High
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
5.0
Malicious package may avoid detection in python auditing
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.
- Record
CVE-2020-5252- CVSS 3.1
- 5.0 Medium
CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:C/C:N/I:H/A:N - Weakness
- CWE-807
- Updated
- 2026-11-02
EUVDEUVD-2020-0170
5.0
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.
- Record
EUVD-2020-0170- CVSS 3.1
- 5.0 Medium
CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:C/C:N/I:H/A:N - Updated
- 2026-11-03
GitHub AdvisoriesGHSA-7q25-qrjw-6fg2
5.0
Malicious package may avoid detection in python auditing
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.pysettings installs amalicious.pthfile to yoursite-packagesdirectory. - The
malicious.pthfile gets loaded anytime Python starts, which in turn imports ourmaliciouspackage. - The
malicious/__init__.pypatches the safety library with a custom function to avoid detection.
- Record
GHSA-7q25-qrjw-6fg2- CVSS 3.1
- 5.0 Medium
CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:C/C:N/I:H/A:N - Weakness
- CWE-807
- Updated
- 2026-11-02
NVD
5.0
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.
- Record
CVE-2020-5252- CVSS 3.1
- 5.0 Medium
CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:C/C:N/I:H/A:N - CVSS 3.1
- 4.1 Medium
CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:H/A:N - CVSS 2.0
- 1.9 Low
AV:L/AC:M/Au:N/C:N/I:P/A:N - Weakness
- CWE-807
- Updated
- 2026-11-02
OSV
4.1
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.
- Record
CVE-2020-5252- CVSS 3.1
- 4.1 Medium
CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:H/A:N - Updated
- 2026-11-02
OSVGHSA-7q25-qrjw-6fg2
5.0
Malicious package may avoid detection in python auditing
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.pysettings installs amalicious.pthfile to yoursite-packagesdirectory. - The
malicious.pthfile gets loaded anytime Python starts, which in turn imports ourmaliciouspackage. - The
malicious/__init__.pypatches the safety library with a custom function to avoid detection.
- Record
GHSA-7q25-qrjw-6fg2- CVSS 3.1
- 5.0 Medium
CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:C/C:N/I:H/A:N - Weakness
- CWE-807
- Updated
- 2026-11-02
OSVPYSEC-2020-101 No score
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.
- Record
PYSEC-2020-101- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
safetyPyPI |
before 1.9.0 | 1.9.0 |
safetyPyPI |
before 1.9.0, plus listed versions 0.1.00.2.00.2.10.2.20.3.0 Show 27 moreShow less0.4.00.5.00.5.10.6.01.0.01.0.11.0.21.1.01.1.11.2.01.3.01.4.01.4.11.5.01.5.11.6.01.6.11.7.01.8.01.8.11.8.21.8.31.8.3b01.8.41.8.51.8.61.8.7 |
1.9.0 |
safetyPyPI |
before 1.8.7, plus listed versions 0.1.00.2.00.2.10.2.20.3.0 Show 26 moreShow less0.4.00.5.00.5.10.6.01.0.01.0.11.0.21.1.01.1.11.2.01.3.01.4.01.4.11.5.01.5.11.6.01.6.11.7.01.8.01.8.11.8.21.8.3b01.8.31.8.41.8.51.8.6 |
1.8.7 |
History
| Recorded | Changed | Sources |
|---|---|---|
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2020-5252 is a medium vulnerability (CVSS 5.0) in Pyup Safety, published March 23, 2020. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.37%, the 30th percentile. Fixed in safety 1.9.0.
References
github.com/pyupio/safety/security/advisories/GHSA-7q25-qrjw-6fg2
pyup.io/posts/patched-vulnerability
github.com/akoumjian/python-safety-vuln
nvd.nist.gov/vuln/detail/CVE-2020-5252
github.com/pypa/advisory-database/tree/main/vulns/safety/PYSEC-2020-101.yaml
mulch.dev/blog/CVE-2020-5252-python-safety-vuln
github.com/advisories/GHSA-7q25-qrjw-6fg2
github.com/pyupio/safety