PyPI logo

Malicious Python packages caught stealing Discord tokens, installing shells

The operators of the Python Package Index (PyPI) have removed this week 11 Python libraries from their portal for various malicious behaviors, including the collection and theft of user data, passwords, and Discord access tokens and the installation of remote access shells for remote access to infected systems.

According to the security team at DevOps platform JFrog, which discovered this set of malicious libraries, the 11 packages had been downloaded and installed more than 30,000 times before the packages were spotted and reported.

Worth mentioning is that the packages did not appear to have been developed by the same author, as each contained a slightly different malicious behavior and method of exfiltrating data from infected systems, as detailed in the table below.

Package# of downloadsAutomated detection indicatorsDescription


Shell process with obfuscated input  Hidden connectback shell to, using the trevorc2 client
pptest10001Suspicious version²Uses DNS to send hostname+'|'+os.getcwd()+'|'+str(self.get_wan_ip())+'|'+local_ip_str
ipboards946Sensitive file handling Suspicious versionDependency confusion, sends user info (username, hostname) via DNS tunneling to
owlmoon3285eval with obfuscated input Discord token stealer trojan. Sends tokens to
DiscordSafety557exec with obfuscated inputDiscord token stealer trojan. Sends tokens to
trrfab287Sensitive file handling Suspicious version Dependency confusion, sends user info (id, hostname, /etc/passwd, /etc/hosts, /home) to


Shell spawning Suspicious versionConnectback shell to hardcoded address
yandex-yt4183Suspicious versionPrints pwned message and directs to, could be a malicious domain (currently seems inactive)
yiffparty1859eval with obfuscated inputDiscord token stealer trojan. Sends tokens to

Ten of the eleven packages were outright malicious, as it is clear from the table above. One, named yandex-yt, appears to be some sort of test or joke, but one that could easily turn into a malware delivery channel.

One important observation is that two of the 11 packages also abused a new technique called dependency confusion, a technique where attackers register packages with names that might be used inside closed corporate networks, hoping that their public package gets pulled when the corporate package was deleted and the dependency tree was not updated.

JFrog researchers have published an in-depth analysis for each of the 11 malicious PyPI packages they have discovered.

This marks the second time this year when JFrog researchers have discovered malicious Python libraries after finding another eight earlier this year, in July.

Get more insights with the
Recorded Future
Intelligence Cloud.
Learn more.
No previous article
No new articles

Catalin Cimpanu

Catalin Cimpanu

is a cybersecurity reporter who previously worked at ZDNet and Bleeping Computer, where he became a well-known name in the industry for his constant scoops on new vulnerabilities, cyberattacks, and law enforcement actions against hackers.