The administrators of the Python Package Index (PyPI) repository have quarantined the package “aiocpa” following a new update that included malicious code to steal private keys via Telegram.
The package in question described both synchronous and asynchronous Crypto Pay API the client. The pack, originally released in September 2024, has already been downloaded 12,100 times to date.
Placing a Python library in quarantine prevents it from being further installed by clients and cannot be modified by its maintainers.
Cyber security company Phylum, which general details of the attack on the software supply chain last week, said the author of the package released a malicious update to PyPI while preserving the library GitHub repository clean in an attempt to avoid detection.
It’s unclear at this point if the original developer was behind the fake update or if his credentials were compromised by another threat.
Signs of malicious activity were first seen in version 0.1.13 of the library, which included changes to the Python “sync.py” script, which is designed to decode and run a confusing block of code immediately after installing the package.
“This particular block is recursively encoded and compressed 50 times,” Fillum said, adding that it is used to capture and transfer the victim’s Crypto Pay API token using a Telegram bot.
It should be noted that Crypto Pay is advertised as a payment system based on Crypto bot (@CryptoBot) that allows users to accept payments in crypto and transfer coins to users using an API.
The incident is important not least because it highlights the importance of scanning a package’s source code before downloading them, rather than just checking its associated repositories.
“As demonstrated here, attackers can intentionally maintain clean source code repositories by spreading malicious packages across ecosystems,” the company said, adding that the attack “serves as a reminder that a package’s previous security record does not guarantee its continued security.”