Supply‑Chain Attack Turns Popular npm Codegen Tool Into Credential‑Stealing Worm
A widely adopted npm package that automates the creation of TanStack Query code, @7nohe/openapi-react-query-codegen, has been compromised to deliver a self‑propagating credential‑stealing payload known as Shai‑Hulud. The malicious version of the library has already been downloaded tens of thousands of times, leveraging the package's more than 150,000 weekly installs to spread quickly across JavaScript projects.
The intrusion was discovered after security researchers observed unexpected network calls from applications that depended on the package. Analysis revealed that the attacker had inserted a script into the package's release artifacts that, once executed, harvested environment variables, configuration files and stored credentials before attempting to replicate itself by publishing altered copies of the same module under the legitimate name.
Supply‑chain attacks on open‑source ecosystems have risen sharply in recent years, with npm, PyPI and other registries becoming attractive targets because of their trust model. Packages that generate code or manage API interactions are especially valuable to threat actors, as they run early in the build process and often have access to sensitive tokens used for deployment, cloud services, or database connections.
Project maintainers responded by revoking the compromised releases and publishing a clean version of @7nohe/openapi-react-query-codegen. They also issued guidance urging developers to audit their dependency lockfiles, rotate any credentials that may have been exposed, and enable two‑factor authentication on npm accounts. The incident underscores the importance of using tools such as npm’s audit, provenance signatures, and automated dependency monitoring to detect tampering.
While the exact scope of data exfiltrated remains unclear, the episode adds to a growing list of high‑profile supply‑chain breaches that have prompted calls for tighter security standards across the open‑source community. Industry groups are now debating mandatory code‑signing for published packages and more rigorous vetting of maintainers. For developers, the immediate takeaway is to treat every third‑party library as a potential attack surface and to adopt a “zero‑trust” stance when integrating external code into production pipelines.
Comments (0)
Be the first to comment.
Join the discussion