The discovery of malicious PyPI packages targeting Telegram bot developers highlights the growing risk of installing unofficial forks of popular open-source libraries.

The campaign, known as Operation Navy Ghost, used at least eight trojanized versions of the Pyrogram framework. These packages contained the legitimate Pyrogram code but added a hidden backdoor that activated when a Telegram bot started.

Once active, the backdoor allowed attackers to send secret Telegram commands that executed arbitrary Python code or operating-system commands on the bot server. This could expose environment variables, databases, credentials, cloud API keys, Telegram chats, contacts, and files accessible to the application.

The malicious packages were designed to remain quiet by suppressing errors and disabling logging. They also activated specifically on bot accounts, which are more likely to run continuously on production servers with access to sensitive infrastructure.

Developers who installed the affected packages should remove them immediately, revoke Telegram bot tokens, rotate all credentials stored or used on the server, and investigate the system for additional persistence.

Organizations should use approved package repositories, verify package ownership and provenance, pin dependencies, and carefully review forks before installation. Automated software-composition analysis can also help identify malicious or unexpected dependencies.

The key lesson is that a package containing genuine open-source code can still be malicious when a small hidden component is added. Familiar functionality and successful installation do not prove that the software is trustworthy. In this case, the bot framework did its advertised job while quietly giving someone else control of the server, which is impressively efficient in exactly the wrong way.


A campaign active since last November has been targeting Python developers building Telegram bots with trojanized Pyrogram forks that allow attackers to read arbitrary files on compromised servers. [...]

Source: Malicious PyPI packages give hackers control of Telegram bot servers via Bleeping Computer — published 30 Jun 2026.