{"id":11846,"date":"2025-03-26T13:43:13","date_gmt":"2025-03-26T13:43:13","guid":{"rendered":"https:\/\/fusionmindlabs.com\/blogs\/npm-package-modifies-ethers-for-reverse-shell-attacks\/"},"modified":"2025-03-26T13:43:14","modified_gmt":"2025-03-26T13:43:14","slug":"npm-package-modifies-ethers-for-reverse-shell-attacks","status":"publish","type":"post","link":"https:\/\/fusionmindlabs.com\/blogs\/npm-package-modifies-ethers-for-reverse-shell-attacks\/","title":{"rendered":"npm Package Modifies &#8216;ethers&#8217; for Reverse Shell Attacks"},"content":{"rendered":"\n<\/p>\n<div>\n<p><span class=\"p-author\"><i class=\"icon-font icon-calendar\">\ue802<\/i><span class=\"author\">Mar 26, 2025<\/span><i class=\"icon-font icon-user\">\ue804<\/i><span class=\"author\">Ravie Lakshmanan<\/span><\/span><span class=\"p-tags\">Supply Chain Attack \/ Malware <\/span><\/p>\n<\/div>\n<div id=\"articlebody\">\n<div class=\"separator\" style=\"clear: both;\">\n<a href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEjm19ea33wkpMAbyvqzp0vxy-RfpA56lEd4SvwlGAsGWk8Dme-HE04lZhJ74SBFhmQQ3fk5J1tvHnMRJWaU-kY6xMluVMeQ1RNRIi1kScofqJIjY4bN_hujNnYn2Uhe40hE_i8k8UZyTwDrbwN_OV8JUXAMUa78Jp59vlT_fJDidvvREIqw6f5S1bL8UGen\/s728-rw-e365\/npm.png\" style=\"clear: left; display: block; float: left;  text-align: center;\" rel=\"nofollow noopener\" target=\"_blank\"><\/p>\n<p><\/a>\n<\/div>\n<p>Cybersecurity experts have identified two rogue packages on the npm registry that have been designed to compromise a locally installed package, demonstrating the ongoing evolution of software supply chain attacks targeting the open-source ecosystem.<\/p>\n<p>The packages in question, <a href=\"https:\/\/npm-stat.com\/charts.html?package=ethers-provider2\" rel=\"noopener nofollow\" target=\"_blank\">ethers-provider2<\/a> and <a href=\"https:\/\/npm-stat.com\/charts.html?package=ethers-%20providerz\" rel=\"noopener nofollow\" target=\"_blank\">ethers-providerz<\/a>, have been found to be malicious, with the former having been downloaded 73 times since its publication on March 15, 2025. The latter package, which was likely removed by the malware author, did not attract any downloads.<\/p>\n<p>According to ReversingLabs researcher Lucija Valenti\u0107, &#8220;They were simple downloaders whose malicious payload was cleverly hidden,&#8221; in a report shared with The Hacker News.<\/p>\n<div class=\"dog_two clear\">\n<center class=\"cf\"><br \/>\n<a href=\"https:\/\/thehackernews.uk\/cis-securesuite\" rel=\"nofollow noopener sponsored\" target=\"_blank\" title=\"Cybersecurity\"><br \/>\n<img fetchpriority=\"high\" decoding=\"async\" class=\"lazyload\" alt=\"Cybersecurity\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhsFQaSLfkFdKcodtNnSya8V2yj1C_ZVcqQImhnHDikdLhrgZ4hoAIdzNPEjMn6tIl2dSBa9PZVJm5Q6CW4Iprd32O0xaNt3UTVX1U9kEK629GDLqpr7Dd6lynygeNXdkuKNi_TlVZ1vRZI_fXFdvFwBm25WNf4tQHZfgpXHiaw1nnd6E5jLX8vrn4fB3mN\/s728-e100\/cis-d.png\" width=\"727\" height=\"90\"\/><br \/>\n<\/a><br \/>\n<\/center>\n<\/div>\n<p>&#8220;The interesting aspect of these packages lies in their second stage, which would &#8216;patch&#8217; the legitimate npm package <a href=\"https:\/\/www.npmjs.com\/package\/ethers\" rel=\"noopener nofollow\" target=\"_blank\">ethers<\/a>, installed locally, with a new file containing the malicious payload. This patched file would ultimately serve as a reverse shell.&#8221;<\/p>\n<p>This development marks a new escalation of threat actors&#8217; tactics, as removing the rogue packages won&#8217;t eliminate the malicious functionality from compromised machines, since the changes reside in the popular library. Furthermore, if an unsuspecting user removes the ethers package when ethers-provider2 remains on the system, it risks reinfection when the package is installed again at a later time.<\/p>\n<p>ReversingLabs&#8217; analysis of ethers-provider2 has revealed that it is essentially a trojanized version of the widely-used <a href=\"https:\/\/www.npmjs.com\/package\/ssh2\" rel=\"noopener nofollow\" target=\"_blank\">ssh2<\/a> npm package that includes a malicious payload within install.js to retrieve a second-stage malware from a remote server (&#8220;5.199.166[.]1:31337\/install&#8221;), write it to a temporary file, and run it.<\/p>\n<p>Upon execution, the temporary file is deleted from the system in an attempt to avoid leaving any traces. The second-stage payload then starts an infinite loop to check if the npm package ethers is installed locally.<\/p>\n<div class=\"separator\" style=\"clear: both;\">\n<a href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhOHtJ2F8TusUuRR_P-saHsvD-PXDo1OmkFX8jTHybsOiG_kJgdGiJKTyjP_VVHylOnKnI4x0cTgYoaKyM3xkvaKRCJKM9c2wDGBLPE-Sy7RDBx_DV6YZk1_XYByEeEyav64yND-B3wLkMxjo-hBf6dDBfd64Z3xw-AZkZgnZbZFyPHfEohmqTG8Qd2qX4b\/s728-rw-e365\/code.png\" style=\"clear: left; display: block; float: left;  text-align: center;\" rel=\"nofollow noopener\" target=\"_blank\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhOHtJ2F8TusUuRR_P-saHsvD-PXDo1OmkFX8jTHybsOiG_kJgdGiJKTyjP_VVHylOnKnI4x0cTgYoaKyM3xkvaKRCJKM9c2wDGBLPE-Sy7RDBx_DV6YZk1_XYByEeEyav64yND-B3wLkMxjo-hBf6dDBfd64Z3xw-AZkZgnZbZFyPHfEohmqTG8Qd2qX4b\/s728-rw-e365\/code.png\" alt=\"Malicious npm Package\" border=\"0\" data-original-height=\"395\" data-original-width=\"935\" title=\"Malicious npm Package\"\/><br \/>\n<\/a>\n<\/div>\n<p>In the event that the package is already present or gets freshly installed, it springs into action by replacing one of the files named &#8220;provider-jsonrpc.js&#8221; with a counterfeit version that packs in additional code to fetch and execute a third-stage from the same server. The newly downloaded payload functions as a reverse shell to connect to the threat actor&#8217;s server over SSH.<\/p>\n<p>Valenti\u0107 noted, &#8220;That means that the connection opened with this client turns into a reverse shell once it receives a custom message from the server. Even if the package ethers-provider2 is removed from a compromised system, the client will still be used under certain circumstances, providing a degree of persistence for the attackers.&#8221;<\/p>\n<p>It is essential to note that the official ethers package on the npm registry is not compromised, as the malicious modifications are made locally post-installation.<\/p>\n<div class=\"dog_two clear\">\n<center class=\"cf\"><br \/>\n<a href=\"https:\/\/thehackernews.uk\/cloud-ai-d\" rel=\"nofollow noopener sponsored\" target=\"_blank\" title=\"Cybersecurity\"><br \/>\n<img decoding=\"async\" class=\"lazyload\" alt=\"Cybersecurity\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEiSCOAe1VcPqudCfDCPhh-g5wBvLsaz_frXFhGVPG_yPr-e-Y_9oqVjzAuW5Ywuspn_7ZQvCAWhx52iofUIHBwjMusM5C199AJ9njiV0nZygnKwYRTbPVixr-TfhyphenhyphenbuqiL9VuAgl2xAY1ky_f9u-wiRWvA_KJiVnnGA9DZE3qBFjpIOrpNAFqvyMMfAcbEh\/s728-e100\/cloud-ai-d.jpg\" width=\"727\" height=\"90\"\/><br \/>\n<\/a><br \/>\n<\/center>\n<\/div>\n<p>The second package, ethers-providerz, also behaves similarly in that it attempts to alter files associated with a locally installed npm package called &#8220;@ethersproject\/providers.&#8221; Although the exact npm package targeted by the library is unknown, source code references indicate it could have been <a href=\"https:\/\/www.npmjs.com\/package\/loader.js\" rel=\"noopener nofollow\" target=\"_blank\">loader.js<\/a>.<\/p>\n<p>These findings highlight the novel ways threat actors are serving and persisting malware in developer systems, making it crucial that packages from open-source repositories are carefully scrutinized before downloading and using them.<\/p>\n<p>Valenti\u0107 emphasized, &#8220;Despite the low download numbers, these packages are powerful and malicious. If their mission is successful, they will corrupt the locally installed package ethers and maintain persistence on compromised systems even if that package is removed.&#8221;<\/p>\n<p><\/p>\n<div class=\"cf note-b\">Found this article interesting?  Follow us on <a href=\"https:\/\/twitter.com\/thehackersnews\" rel=\"noopener nofollow\" target=\"_blank\">Twitter <i class=\"icon-font icon-twitter\">\uf099<\/i><\/a> and <a href=\"https:\/\/www.linkedin.com\/company\/thehackernews\/\" rel=\"noopener nofollow\" target=\"_blank\">LinkedIn<\/a> to read more exclusive content we post.<\/div>\n<\/div>\n<p><script async src=\"\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><br \/>\n<br \/>\n<br \/><a href=\"https:\/\/thehackernews.com\/2025\/03\/malicious-npm-package-modifies-local.html\" rel=\"nofollow noopener\" target=\"_blank\">Source Link<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ue802Mar 26, 2025\ue804Ravie LakshmananSupply Chain Attack \/ Malware Cybersecurity experts have identified two rogue packages on the npm registry that have been designed to compromise a locally installed package, demonstrating&#8230;<\/p>\n","protected":false},"author":19,"featured_media":11847,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[46,39,32,31,33,34,35,40,36,37,42,44,43,41,38,45],"class_list":["post-11846","post","type-post","status-publish","format-standard","has-post-thumbnail","category-cybersecurity","tag-computer-security","tag-cyber-attacks","tag-cyber-news","tag-cyber-security-news","tag-cyber-security-news-today","tag-cyber-security-updates","tag-cyber-updates","tag-data-breach","tag-hacker-news","tag-hacking-news","tag-how-to-hack","tag-information-security","tag-network-security","tag-ransomware-malware","tag-software-vulnerability","tag-the-hacker-news"],"jetpack_featured_media_url":"https:\/\/fusionmindlabs.com\/blogs\/wp-content\/uploads\/sites\/9\/2025\/03\/npm.png","_links":{"self":[{"href":"https:\/\/fusionmindlabs.com\/blogs\/wp-json\/wp\/v2\/posts\/11846","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fusionmindlabs.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fusionmindlabs.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fusionmindlabs.com\/blogs\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/fusionmindlabs.com\/blogs\/wp-json\/wp\/v2\/comments?post=11846"}],"version-history":[{"count":1,"href":"https:\/\/fusionmindlabs.com\/blogs\/wp-json\/wp\/v2\/posts\/11846\/revisions"}],"predecessor-version":[{"id":11848,"href":"https:\/\/fusionmindlabs.com\/blogs\/wp-json\/wp\/v2\/posts\/11846\/revisions\/11848"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fusionmindlabs.com\/blogs\/wp-json\/wp\/v2\/media\/11847"}],"wp:attachment":[{"href":"https:\/\/fusionmindlabs.com\/blogs\/wp-json\/wp\/v2\/media?parent=11846"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fusionmindlabs.com\/blogs\/wp-json\/wp\/v2\/categories?post=11846"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fusionmindlabs.com\/blogs\/wp-json\/wp\/v2\/tags?post=11846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}