Beware of Malicious PyPI Packages: How Typos Turn Into Crypto‑Mining Malware

A simple typo when using pip can install a malicious PyPI package that hides cryptomining code, and security researchers have uncovered dozens of such deceptive packages, highlighting the supply‑chain risks of Python's package ecosystem and offering practical mitigation steps.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Beware of Malicious PyPI Packages: How Typos Turn Into Crypto‑Mining Malware

Malicious PyPI Packages

Installing Python software via PyPI is convenient, but a simple typo can pull a malicious package. For example, running pip install openvc installs the malicious openvc package instead of the intended opencv.

Security firm Sonatype reports that many malicious packages masquerade as popular PyPI libraries, differing by only a few characters, and often embed cryptomining code.

Mining Software Disguised as Popular Libraries

Common plotting library matplotlib has several look‑alike malicious packages such as mplatlib , maratlib , and others uploaded by the user nedog123 . In total, seven impostor packages have been identified.

These packages depend on each other; for instance, learninglib depends on maratlib. Some hide dependencies, e.g., mplatlib disguises its dependency as “LKEK”.

Illustration of malicious PyPI packages
Illustration of malicious PyPI packages

Deep Obfuscation and Cryptomining Payloads

Analysis of maratlib 1.0 shows heavy obfuscation, making it hard to see the hidden code. Version 0.6 reveals that it downloads and executes a Bash script from GitHub, which in turn fetches the cryptominer “Ubqminer” and includes the attacker’s wallet address.

PyPI has removed these packages, but they have already been downloaded more than 5,000 times.

Why PyPI Supply‑Chain Risks Matter

These incidents are only the tip of the iceberg. Earlier attacks in 2016 used similar naming tricks, affecting 1.7 k developers and running 45 k times, even compromising U.S. military systems.

To mitigate risk, monitor the behavior of setup.py, install suspicious packages inside isolated containers, and capture system calls and network traffic. The same caution applies to other package managers such as npm and gem.

References: Sonatype blog, Ars Technica, Freebuf, GitHub repository.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Pythonsupply chainSecuritypackage managementmalwarePyPIcryptomining
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.