A sophisticated phishing email, disguised as an official npm support message, tricked a maintainer into providing his credentials and a two-factor authentication (2FA) token on a fake login page. This was a classic adversary-in-the-middle (AitM) attack, which allowed the attackers to gain control of the account and publish a rogue version of the packages. The compromised account belonged to Josh Junon, a maintainer of several widely used npm packages.
Once inside, the attackers injected obfuscated malware into the source code. This malicious payload is a browser-based interceptor designed to hijack web traffic and application APIs, specifically targeting users with connected cryptocurrency wallets. When a user initiates a transaction, the malware swaps the destination wallet address with an attacker-controlled wallet that looks deceptively similar. It even uses the Levenshtein distance to find a close match, making the theft harder to spot.
The attack affected 20 npm packages, including popular ones like chalk and debug, which are downloaded billions of times a week. This incident highlights the significant risks in the modern software supply chain, where the compromise of a single popular open-source project can impact millions of end users and organizations. Security experts have pointed out that this type of attack is a standard tactic for advanced persistent threat groups, as it offers a broad reach with minimal effort.
This incident is part of a larger trend of attackers targeting package ecosystems like npm and PyPI. Beyond direct account takeovers, malicious actors also employ other deceptive tactics like typosquatting and slopsquatting to trick developers into installing malware. The attack is a stark reminder of the need for heightened vigilance, the hardening of CI/CD pipelines, and the locking down of dependencies to prevent similar compromises in the future.
According to a recent report, 14 of the 23 crypto-related malicious campaigns in 2024 targeted npm. Experts have stated that the malicious payload in this specific attack was focused on crypto theft, but the same account takeover method could be used to steal secrets, leave backdoors, and infiltrate organizations. The incident serves as a crucial lesson that robust security measures are not just for large corporations but for everyone involved in the software supply chain.
Reference: