Логотип exploitDog
Консоль
Логотип exploitDog

exploitDog

github логотип

GHSA-7q25-qrjw-6fg2

Опубликовано: 24 мар. 2020
Источник: github
Github: Прошло ревью
CVSS3: 5

Описание

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.

  1. pip install safety
  2. pip install insecure-package
  3. pip install dist/malicious-0.1-py3-none-any.whl

Run the check

  1. 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.

  1. When you install this package, the setup.py settings installs a malicious.pth file to your site-packages directory.
  2. The malicious.pth file gets loaded anytime Python starts, which in turn imports our malicious package.
  3. The malicious/__init__.py patches the safety library with a custom function to avoid detection.

Пакеты

Наименование

safety

pip
Затронутые версииВерсия исправления

< 1.9.0

1.9.0

EPSS

Процентиль: 21%
0.00069
Низкий

5 Medium

CVSS3

Дефекты

CWE-807

Связанные уязвимости

CVSS3: 5
nvd
почти 6 лет назад

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 separat

EPSS

Процентиль: 21%
0.00069
Низкий

5 Medium

CVSS3

Дефекты

CWE-807