Supply Chain Compromise: Malicious Dropper in mistralai PyPI Package v2.4.6
The mistralai PyPI package v2.4.6 was compromised with a malicious dropper that executes on module import on Linux systems, bypassing the legitimate release pipeline via PyPI Trusted Publishing. This represents a high-impact supply chain attack affecting all systems that installed this specific version.
Affected
Vulnerability Description
This is a supply chain compromise involving unauthorized package tampering. The mistralai PyPI package v2.4.6 contains injected malicious code that executes at module load time, before any user code runs. The vulnerability class is arbitrary code execution via dependency injection. The root cause is unauthorized access to the PyPI upload mechanism—the attacker bypassed the repository's PyPI Trusted Publishing workflow, indicating either credential compromise, account takeover, or PyPI infrastructure exploitation. The impact is severe: any system importing mistralai==2.4.6 automatically executes attacker-controlled code with the privileges of the importing process.
Proof-of-Concept Significance
This PoC is significant because it demonstrates a fully realized, in-the-wild supply chain attack rather than a theoretical vulnerability. The malicious code uses obfuscated imports and conditional execution (Linux-only, environment variable gating) to evade casual inspection. The dropper fetches a secondary payload (transformers.pyz) from an external C2 server and executes it asynchronously in a new session, designed for stealth. Preconditions are minimal: any Python environment that installed this exact version and imported the package is compromised. The attack is reliable and deterministic.
Detection Guidance
Package-level indicators:
- Scan pip freeze/requirements outputs for
mistralai==2.4.6; usepip show mistralaito confirm installed version - Query PyPI API or use tools like
safetyto flag this CVE-less advisory - Monitor pip logs for
mistralaipackage installations around the compromise window
Runtime indicators:
- File creation in
/tmp/transformers.pyzon Linux systems - Process spawning of
python /tmp/transformers.pyzwithDEVNULLredirects (suspicious backgrounding) - Outbound HTTPS connections to
83.142.209.194on port 443 - Environment variable
MISTRAL_INIT=1set in child process environments curlorwgetsubprocesses with-k(insecure SSL) and-L(follow redirects) flags
Logs to monitor:
- Application stderr/stdout for import errors (malformed code may cause exceptions)
- System auditd logs for file access to
/tmp/transformers.pyz - Network logs for DNS/TLS to
83.142.209.194(may be sinkholed)
Mitigation Steps
- Immediate: Uninstall
mistralai==2.4.6from all environments:pip uninstall mistralai==2.4.6 -y - Verify: Downgrade to
mistralai==2.4.5or earlier; confirm viapip show mistralai - Isolation: Quarantine or rebuild any system that imported the malicious version; review process logs for secondary payload execution
- Remediation: Kill any lingering
python /tmp/transformers.pyzprocesses; delete/tmp/transformers.pyzif present - Scanning: Run full system antivirus/EDR scans on affected hosts; check for persistence mechanisms
- Future prevention: Enforce pip dependency pinning, use
pip-auditorsafetyin CI/CD, restrict outbound HTTPS to known-good hosts, and audit PyPI account access logs
Risk Assessment
Likelihood of exploitation: Very high. This is an active, confirmed breach affecting all users of v2.4.6. The package is quarantined but may already be downloaded/cached. Threat actors likely have a distribution list of affected systems.
Threat actor interest: Critical. Supply chain attacks on widely-used ML/AI packages (mistralai has significant adoption) are highly valued. This attack pattern (dropper → secondary payload) is consistent with APT tradecraft, suggesting organized threat activity rather than opportunistic abuse. The use of HTTPS C2, session isolation, and conditional execution indicates operational sophistication. Organizations using mistralai in production are at immediate risk of full system compromise.
Sources