Recent investigations have unveiled a series of malicious packages infiltrating popular open-source repositories, including Python Package Index (PyPI), npm, and RubyGems. These packages are designed to steal cryptocurrency funds, erase codebases, and exfiltrate sensitive information, highlighting the persistent threats within open-source ecosystems.
Malicious RubyGems Packages Exploit Telegram Ban
Security researchers have identified two malicious RubyGems packages, fastlane-plugin-telegram and telegram-notifier, which exfiltrate data sent to the Telegram API by redirecting traffic through a command-and-control (C2) server controlled by the attackers. These packages were published shortly after Vietnam’s nationwide ban on Telegram, suggesting that threat actors are exploiting geopolitical events to launch targeted supply chain attacks. The malicious gems are near-identical clones of the legitimate fastlane-plugin-telegram, a widely used library for sending deployment notifications to Telegram channels from CI/CD pipelines. The attackers modified the network endpoint to a hard-coded server, effectively acting as a relay between the victim and the Telegram API, while silently harvesting sensitive data. This campaign illustrates how quickly threat actors can exploit geopolitical events to launch targeted supply chain attacks.
Destructive npm Package Targets Developers
An npm package named xlsx-to-json-lh has been discovered to contain a hidden payload that establishes a persistent connection to a C2 server. When triggered, it can delete entire project directories without warning or recovery options. The package, which typosquats the legitimate xlsx-to-json-lc, was first published in February 2019 and has since been taken down. The destruction actions are unleashed once the French command remise à zéro (meaning reset) is issued by the C2 server, causing the package to delete source code files, version control data, configuration files, node_modules (including itself), and all project assets.
Credential-Stealing npm Packages
Several malicious npm packages have been found to steal cryptocurrency funds by siphoning a significant portion of the funds present in users’ wallets. These packages, including pancake_uniswap_validators_utils_snipe, pancakeswap-oracle-prediction, ethereum-smart-contract, and env-process, have been identified as threats to developers and users alike.
Malicious npm and PyPI Packages Disguised as Developer Tools
The Socket Threat Research Team has uncovered three malicious packages—one on the npm registry and two on PyPI—designed to exfiltrate cryptocurrency secrets, including mnemonic seed phrases and private keys. These packages pose as legitimate developer tools but secretly extract sensitive information. For example, the npm package react-native-scrollpageviewtest poses as a page-scrolling helper but dynamically loads the host React Native wallet engine, extracts private keys and mnemonic seed phrases, and exfiltrates them using Google Analytics as its exfiltration channel. Similarly, the PyPI package web3x poses as an Ethereum balance checker but silently exfiltrates the victim’s mnemonic seed phrase to a Telegram bot. ([socket.dev](https://socket.dev/blog/malicious-npm-and-pypi-packages-steal-wallet-credentials?utm_source=openai))
Malicious npm Packages Deploying Reverse Shells
A new set of 48 malicious npm packages have been discovered in the npm repository with capabilities to deploy a reverse shell on compromised systems. These packages, deceptively named to appear legitimate, contained obfuscated JavaScript designed to initiate a reverse shell upon installation. All the counterfeit packages were published by an npm user named hktalent. The attack chain is triggered post the installation of the package via an install hook in the package.json that calls a JavaScript code to establish a reverse shell to a remote server. ([thehackernews.com](https://thehackernews.com/2023/11/48-malicious-npm-packages-found.html?utm_source=openai))
Malicious PyPI and npm Packages Stealing SSH Keys
A stream of malicious npm and PyPI packages have been found stealing a wide range of sensitive data from software developers on the platforms. The campaign started on September 12, 2023, and was first discovered by Sonatype, whose analysts unearthed 14 malicious packages on npm. The data stolen by the packages includes sensitive machine and user information, as well as SSH private keys. These details and the Kubernetes configurations stored on kubeconfig files and SSH private keys in ~/.ssh/id_rsa are written in a text file and sent to the attackers’ servers. ([bleepingcomputer.com](https://www.bleepingcomputer.com/news/security/ssh-keys-stolen-by-stream-of-malicious-pypi-and-npm-packages/?utm_source=openai))
Cryptomining Packages Flood npm and PyPI Registries
More than 200 malicious packages have been discovered infiltrating the PyPI and npm open-source registries. These packages are largely typosquats of widely used libraries and each one of them downloads a Bash script on Linux systems that run cryptominers. For example, Sonatype spotted 186 malicious packages flooding the npm registry, impersonating the heavily used http-errors JavaScript library. These packages pull content from a Bit.ly URL and silently execute a script while muting its output, effectively mining cryptocurrency on infected systems. ([sonatype.com](https://www.sonatype.com/blog/more-than-200-cryptominers-flood-npm-and-pypi-registry?utm_source=openai))
Open Source Package Analysis Tool Identifies Malicious Packages
The Open Source Security Foundation (OpenSSF) has introduced a Package Analysis tool that tracks changes in how packages behave over time to identify when previously safe software begins acting suspiciously. In its test run that lasted under a month, Package Analysis was able to identify more than 200 malicious PyPI and npm components. The vast majority of these malicious packages are dependency confusion and typosquatting attacks. ([bleepingcomputer.com](https://www.bleepingcomputer.com/news/security/open-source-package-analysis-tool-finds-malicious-npm-pypi-packages/?utm_source=openai))
Conclusion
The discovery of these malicious packages underscores the critical need for vigilance within the open-source community. Developers are urged to exercise caution when incorporating third-party packages, verify the authenticity of libraries, and stay informed about emerging threats to safeguard their projects and users.