Cybersecurity researchers have identified three malicious npm packages in the registry designed to mimic a popular Telegram bot library. These packages, named node-telegram-utils, node-telegram-bots-api, and node-telegram-util, were created to trick developers into downloading them. They exploit the popularity of the legitimate node-telegram-bot-api, which is widely used for building Telegram bots in Node.js. Despite having modest download numbers, the impact of a single compromised environment could lead to widespread infiltration.
The packages utilize a technique known as starjacking, which makes them appear more authentic by linking to the GitHub repository of the legitimate library. This approach aims to increase the perceived credibility of the malicious packages. By replicating the legitimate library’s description and leveraging starjacking, the attackers seek to deceive developers into installing the malicious software without suspicion.
Upon installation, these packages target Linux systems and insert two SSH keys into the “~/.ssh/authorized_keys” file. This grants persistent remote access to attackers, allowing them to execute further malicious activities. The packages also collect the system username and external IP address by contacting an external server. Even after the malicious packages are removed, the inserted SSH keys ensure that the attackers maintain control over the compromised systems.
This discovery is part of a broader trend of malicious packages being found on npm. Another example includes the @naderabdi/merchant-advcash package, which disguises itself as a tool for merchants to manage cryptocurrency or fiat payments. This package opens a reverse shell to a remote server upon successful payment transactions, making it more difficult to detect. The delayed execution of its payload allows the attack to bypass some security measures, as the malicious code only runs under specific conditions.
.Reference: