Skip to content
supplychainattack.orgSupply chain attack incident catalog
containedcritical

Malicious code in mrmustard (PyPI)

A malicious version of the mrmustard package was published to PyPI containing code that exfiltrates SSH keys, AWS credentials, Kubernetes config, environment variables, and system identifiers to a remote endpoint. The payload includes multiple persistence mechanisms that survive package uninstallation.

ShareXLinkedInHacker News
Disclosed
Last updated
Blast radius
Developers and production systems that installed the malicious mrmustard package from PyPI
Ecosystems
Attack vectors
Affected entities
  • mrmustardMalicious version published to PyPI; legitimate package is from Xanadu

A compromised or impersonated version of the mrmustard package was distributed via PyPI. Upon import, the malicious init.py spawns a background thread that collects sensitive data including SSH private keys from ~/.ssh/, AWS credentials and config files, Kubernetes configuration, environment variables, pip freeze output, and host/GPU/SLURM identifiers.\n\nThe collected data is XOR-encoded with the key 'tf_compat_v2', base64-wrapped, and exfiltrated via HTTP POST to a runtime-reconstructed endpoint using a spoofed browser User-Agent. The code includes detection logic to avoid execution in CI/CD environments (GitHub Actions, GitLab CI, Jenkins, Travis, CircleCI, Buildkite, CodeBuild) and containerized environments (Docker, Kubernetes, LXC).\n\nThree persistence mechanisms are installed under the guise of a 'tensorflow hardware compatibility check': a compiled dropper written to ~/.cache/.tf_cache/hw_probe.pyc, a crontab entry executing every 15 minutes, an 'mmcompat.pth' file in site-packages for Python startup execution, and launcher lines appended to shell configuration files (~/.bashrc, ~/.zshrc, fish config). These mechanisms continue exfiltration even after the package is uninstalled.\n\nThe legitimate MrMustard package is maintained by Xanadu and does not contain this malicious code.

Indicators of compromise

Packages
  • mrmustard

Remediation

  • Identify all systems where mrmustard was installed and assume compromise of SSH keys, AWS credentials, Kubernetes config, and environment variables
  • Revoke and rotate all SSH keys, AWS access keys, and Kubernetes credentials that may have been exposed
  • Remove the malicious mrmustard package via pip uninstall
  • Manually remove persistence mechanisms: delete ~/.cache/.tf_cache/hw_probe.pyc, remove crontab entries, delete mmcompat.pth from site-packages, and remove launcher lines from ~/.bashrc, ~/.zshrc, and fish shell config
  • Audit shell history and process logs for suspicious activity
  • Monitor network traffic for connections to the exfiltration endpoint
  • Use only the legitimate mrmustard package from Xanadu; verify package source and maintainer before installation

Sources

  1. GitHub Advisory GHSA-7h9m-3hvr-pjg2 · GitHub Advisory Database

Cite this entry

"Malicious code in mrmustard (PyPI)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed July 28, 2026; last updated July 28, 2026. https://supplychainattack.org/incident/malicious-code-in-mrmustard-pypi-1y2wbb

Suggest a correction

Found an error or have a newer source? Corrections to factual errors take priority over new entries.

  1. containedcritical

    Malicious code in govapkg (PyPI)

    govapkg, a malicious PyPI package, downloads and executes a hidden binary on first use, establishing persistence via a systemd desktop autostart entry. The package obfuscates its malicious behavior through base64-encoded URLs and downloads from unverified external sources.

    PyPICompromised packageMalicious commit
  2. resolvedcritical

    Malicious code in vtranalytic (PyPI)

    The vtranalytic package on PyPI contained malicious code implementing a Telegram-bot-driven remote administration tool that provides full system control to an attacker holding the configured bot token. The package exfiltrates credentials, SSH keys, and arbitrary files via Telegram API, and executes arbitrary shell commands through a documented `run` command.

    PyPICompromised packageMalicious maintainer
  3. containedcritical

    Malicious code in dev-helper-bg (PyPI)

    The PyPI package dev-helper-bg contained malicious code that executed arbitrary commands on import. The package decrypted and executed remotely-controlled code fetched from an external endpoint, and spawned a Telegram bot for command and control.

    2026 07 Make HelperPyPICompromised packageMalicious commit
  4. containedcritical

    Malicious code in karpatkit (PyPI)

    The karpatkit package on PyPI contained malicious code that exfiltrated sensitive credentials and secrets on import. The package spawned a daemon thread collecting environment variables, cloud credentials, SSH keys, Kubernetes tokens, cryptocurrency wallets, and shell histories, then transmitted them via HTTP to hardcoded IP addresses.

    PyPICompromised packageMalicious commit