THE NPM NIGHTMARE
The largest hack of the year has been recorded. A simple installation of a common avaScript library gave hackers access to the company's cloud infrastructure, repositories, and internal services. The Shai-Hulud worm infiltrated popular npm packages and began spreading via stolen developer credentials. The number of infected components has already exceeded a thousand. We'll tell you the details now.
Hackers first compromised the GitHub account of developer Jared Ray, who maintains the keyv library and several popular caching tools. They then added malicious files directly to the main branch of the projects. Afterward, new versions were deployed via the standard GitHub Actions mechanism. This scheme resulted in the infected builds receiving valid npm signatures and package origin information, making them appear to be legitimate updates. This attack compromised keyv, flat-cache, file-entry-cache, cacheable, cache-manager, and other libraries that are connected to applications indirectly, but through dependency chains. The scale of the infection was enormous. The first infected packages alone accumulated hundreds of millions of downloads. And that's just in a week. Investigators discovered malicious versions of components associated with Deliveroo, OneReach, Picsart, Qlik, and other companies. The total download figures differ from the number of infected devices. This is because some projects can download multiple related libraries at once. Each infected version contained the files setup.mjs and Math_Symbol.js. They also contained the preinstall command in package.json. If npm install was run, the malicious code was executed automatically before the installation was complete. The downloader downloaded the Bun runtime in normal mode, after which it executed the main obfuscated file, approximately 728 KB in size. The malware then searched for npm and GitHub tokens, AWS keys, Kubernetes secrets, Docker credentials, HashiCorp Vault, Slack, and Stripe tokens. The scanner also checked .env files, VPN configurations, KeePass databases, Terraform states, development environment settings, private SSH keys, and database connection strings. On macOS and Linux computers, the malware easily used approximately 200 search patterns and read up to 64 files simultaneously. The data collected by the malware was immediately encrypted and sent to public GitHub repositories with the description "Shai-Hulud: Here We Go Again." Cybersecurity researchers investigating this incident were able to find approximately 1,300 such repositories. The stolen tokens helped the infiltrated worm publish infected versions of packages under the names of new developers. This way, the attack could spread from one project to another without manually hacking each account. In most cases, the criminals obtained publishing tokens from build servers that already had the infected dependency installed. For the developers to "cure" the affected versions, they will need to carry out a tremendous amount of work. We will certainly be following this story as it unfolds. We ourselves are interested in how quickly specialists can mitigate the consequences of such a large-scale intervention.
