In December 2024, users who ran pip install ultralytics, pulling one of the most popular computer-vision libraries in the Python ecosystem, could have received a cryptominer instead of a model. Four malicious versions reached the Python Package Index, and the way the first two got there is the part worth studying: they went out through the project's own release pipeline.
The PyPI maintainers and security firms including ReversingLabs analyzed the compromise. Versions 8.3.41 and 8.3.42 of the ultralytics package, published on 4 and 5 December 2024, contained code that downloaded and ran the XMRig cryptominer. Versions 8.3.45 and 8.3.46 followed on 7 December with the same downloader. The library is a common choice for object detection, so the exposure was large.
Poisoning the build pipeline
The interesting mechanism was GitHub Actions cache poisoning. The project's automated workflow built and published releases to PyPI using trusted publishing, a design meant to remove long-lived credentials from the process. Pull requests with branch names that carried a shell command exploited a script injection in a project workflow, which gave the attacker code execution in a privileged build context. PyPI's analysis says the attack then targeted the GitHub Actions cache used during the build, so malicious code was folded into the artifacts the pipeline published. The attacker subverted the build, and the legitimate automation shipped the result with valid attestations.
The last two versions took a different route. PyPI says 8.3.45 and 8.3.46 were uploaded with a PyPI API token that was still available to the workflow, possibly left over from before the project adopted trusted publishing; ReversingLabs suggests the token was stolen during the first compromise.
# the package's downloader code fetches and runs the XMRig cryptominer
The response
PyPI removed each malicious release within hours of its upload, and the maintainers moved to harden the workflow. The clean-up was itself instructive: 8.3.42, published as the fix, still carried the malicious code, and a clean 8.3.43 followed the same day. Two days later 8.3.45 and 8.3.46 appeared and were also removed. Incident response on a compromised pipeline is hard precisely because the thing you use to ship the fix is the thing that was subverted.
For the AI ecosystem specifically, this matters because model and vision libraries sit deep in data pipelines, often on machines with GPUs, cloud credentials, and network reach. A cryptominer was the visible payload; the same access could have done far more.
The choice of a cryptominer is almost a courtesy, because it made the compromise noticeable: miners are loud, spiking CPU and GPU usage in ways monitoring tends to catch. A quieter attacker, using the same access, could have exfiltrated the cloud credentials and datasets that vision pipelines routinely sit beside, or established persistence, with far less chance of discovery. There is a specific reason this class of attack targets AI libraries: machine-learning packages are frequently installed on infrastructure that is valuable and permissive at once: GPU instances, CI runners with deploy credentials, notebooks wired into data lakes. Combine that with a culture of pulling the newest version to chase model improvements, and you have fertile ground for supply-chain compromise. Pinning dependencies feels like friction against that culture, which is exactly why it has to be deliberately imposed rather than left to habit.
What defenders should take away
- Pin and verify dependencies. Pin exact versions and hashes so a freshly published malicious release cannot be pulled automatically, and review changes before bumping.
- Harden CI as production. Treat build caches, workflow triggers, and pull-request permissions as security-critical; untrusted contributions must not influence release builds.
- Watch for unexpected downloads. Network calls and process spawns when an ML library is installed or imported are a red flag worth alerting on.
- Know your dependency tree. You cannot assess exposure to a compromised package if you do not know it is in your environment.
The Ultralytics incident showed that modern software supply-chain attacks aim upstream of the maintainer, at the automation that everyone trusts. Defending against it starts with a real inventory of what your models and pipelines depend on.
Primary source. Supply-chain attack analysis: Ultralytics, The Python Package Index Blog.