Moderate
CVE-2020-5252
CVE ID
AttackerKB requires a CVE ID in order to pull vulnerability data and references from the CVE list and the National Vulnerability Database. If available, please supply below:
Add References:
CVE-2020-5252
MITRE ATT&CK
Collection
Command and Control
Credential Access
Defense Evasion
Discovery
Execution
Exfiltration
Impact
Initial Access
Lateral Movement
Persistence
Privilege Escalation
Topic Tags
Description
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.
Add Assessment
Ratings
-
Attacker ValueMedium
-
ExploitabilityMedium
Technical Analysis
Description
This is more of a bad configuration and practice from the user that allows an attacker to infect the command-line Safety package’s detection routines by disguising, or obfuscating, other malicious or non-secure packages.
Vulnerable configurations
- 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.
This can easily be fixed.
Exploitation
A malicious package can avoid detection by Safety on load by running code in init.py such as seen in https://github.com/akoumjian/python-safety-vuln/blob/master/malicious/__init__.py which contains a patch.
This results in the package not to be flagged as malicious.
PoC
A great PoC and explanation is available at https://github.com/akoumjian/python-safety-vuln
Would you also like to delete your Exploited in the Wild Report?
Delete Assessment Only Delete Assessment and Exploited in the Wild ReportCVSS V3 Severity and Metrics
General Information
Vendors
- pyup
Products
- safety
References
Additional Info
Technical Analysis
Report as Exploited in the Wild
CVE ID
AttackerKB requires a CVE ID in order to pull vulnerability data and references from the CVE list and the National Vulnerability Database. If available, please supply below: