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.
Betroffene Software
Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.
| Plattform | Paket | Anfällige Versionen | Behoben in |
|---|---|---|---|
| Python (PyPI) | safety | < 1.9.0 | 1.9.0 |
Verweise
- https://pyup.io/posts/patched-vulnerability/
- https://github.com/akoumjian/python-safety-vuln
- https://github.com/pyupio/safety/security/advisories/GHSA-7q25-qrjw-6fg2
- https://nvd.nist.gov/vuln/detail/CVE-2020-5252
- https://github.com/pypa/advisory-database/tree/main/vulns/safety/PYSEC-2020-101.yaml
- https://github.com/pyupio/safety
- https://mulch.dev/blog/CVE-2020-5252-python-safety-vuln
- https://pyup.io/posts/patched-vulnerability
- CVSS-Vektor
CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:C/C:N/I:H/A:N- Schwäche (CWE)
CWE-807- Plattform
- Python (PyPI)
- Paket
safety- Veröffentlicht
- 23.03.2020
- Aktualisiert
- 11.10.2026 13:19
Quellen und Lizenzen
OSV / GitHub Advisory Database - PYSEC-2020-101 - PyPA Advisory Database; CC BY 4.0
OSV / GitHub Advisory Database - GHSA-7q25-qrjw-6fg2 - CC BY 4.0
Schwachstellenhistorie: safety
Alle veröffentlichten Schwachstellen dieses Pakets (Python (PyPI)), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.
Dies ist die einzige bekannte Schwachstelle dieses Pakets.
Erkennen Sie Schwachstellen in Ihrer Anwendung
Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.