A potential disaster within the npm supply chain was narrowly avoided after hackers gained control of a verified developer’s credentials. The incident involved Josh Junon, also known as ‘qix,’ a developer with a significant GitHub presence. On September 8, Junon confirmed on Bluesky that his npm account had been compromised. Users alerted him to the fact that his account was distributing packages with backdoors to popular projects he was associated with.
The security breach occurred when Junon received a deceptive email prompting him to reset his two-factor authentication (2FA) credentials. This email appeared legitimate, leading Junon to fall victim to the attack. Fortunately, the compromise was limited to his npm account, and he promptly contacted NPM to address the issue.
The compromised ‘qix’ npm account distributed malicious versions of numerous packages that Junon was involved in. Some of the affected npm packages included widely-used JavaScript projects such as chalk, strip-ansi, color-convert, color-name, error-ex, simple-swizzle, and has-ansi. These packages collectively receive millions of downloads weekly.
The malicious packages contained a crypto-clipper payload designed to steal funds by altering wallet addresses in network requests and intercepting cryptocurrency transactions. The attack utilized a sophisticated crypto-stealer malware that targeted cryptocurrency users through passive address-swapping attacks and active transaction hijacking.
Despite the severity of the situation, the open-source community responded swiftly to mitigate the threat. Within four hours of Junon confirming the compromise, NPM had removed all affected package versions. While some individuals labeled the incident as the “biggest supply chain attack in history,” experts like Josh Bressers and Katie Paxton-Fear emphasized the rapid and effective response of the open-source community.
Paxton-Fear highlighted that the total financial loss resulting from the attack was estimated at $20, thanks to the collaborative efforts of developers and maintainers. She emphasized that the incident should be seen as a success story showcasing the resilience of the open-source model.
For those concerned about potential impact, immediate steps can be taken to mitigate the threat. Developers can use package.json overrides to enforce safe versions of compromised packages across their projects. By deleting node_modules and package-lock.json and re-running npm install, developers can ensure that no malicious versions remain in their dependency tree.
In conclusion, the swift response to the compromised npm packages demonstrates the effectiveness of community collaboration in addressing security threats within the open-source ecosystem. The incident serves as a reminder of the importance of vigilance and proactive measures to safeguard against supply chain attacks.
