Malicious code in vite-plugin-cleaner (npm)
vite-plugin-cleaner contains a malicious postinstall script that fetches and executes code from an external GitHub repository (vite-cleaning-tools) without pinning to a specific commit or tag. This allows the maintainer or anyone with write access to that repository to execute arbitrary code on installer machines at any time without publishing a new npm version.
- Disclosed
- Last updated
- Blast radius
- All npm installations of vite-plugin-cleaner that trigger the postinstall script; any user or CI/CD system installing this package is affected.
- Ecosystems
- Attack vectors
- Affected entities
- vite-plugin-cleanernpm package with malicious postinstall script
vite-plugin-cleaner (npm) declares an optional dependency on vite-cleaning-tools pointing to a GitHub repository reference without a pinned commit SHA or tag. This means npm resolves and fetches whatever code exists at the current HEAD of that repository during installation.\n\nThe package includes a postinstall script that executes node -e \"try { require('vite-cleaning-tools') } catch(e) {}\", which runs the fetched code on every npm install. The try/catch block silently suppresses any errors, making the execution invisible to users.\n\nBecause the GitHub reference is mutable and external to the npm registry, the maintainer or anyone with write access to the GitHub repository can change the executed code at any moment without publishing a new npm version. This bypasses npm registry scanning and allows for persistent, undetectable code execution on installer machines.\n\nThe incident was identified by the OpenSSF malicious-packages project.
Indicators of compromise
- Packages
- vite-plugin-cleaner
Remediation
- Immediately uninstall vite-plugin-cleaner from all systems and projects
- Audit npm install logs and CI/CD execution logs for any suspicious activity during vite-plugin-cleaner installation
- Review the vite-cleaning-tools GitHub repository commit history to identify what code was executed
- Consider using npm audit to scan for this package in dependency trees
- Use npm lockfiles (package-lock.json) to prevent automatic updates and pin all transitive dependencies
- Implement npm registry-only policies to block external GitHub repository dependencies in postinstall scripts
Sources
- GitHub Advisory GHSA-fg76-p6gh-vq23 · GitHub Advisory Database
Cite this entry
"Malicious code in vite-plugin-cleaner (npm)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed August 7, 2026; last updated August 7, 2026. https://supplychainattack.org/incident/malicious-code-in-vite-plugin-cleaner-npm-opf98c
Suggest a correction
Found an error or have a newer source? Corrections to factual errors take priority over new entries.
Related incidents
- containedcritical
Malicious code in @telekom-ods/react-ui-kit (npm)
@telekom-ods/react-ui-kit version 2.6.9 on npm contained malicious code in an install hook that exfiltrated system information (/etc/passwd, /etc/hosts, /etc/shadow, id output) via HTTP POST to an OAST callback server. The compromised package was published under the legitimate telekom-ods publisher account, suggesting either account takeover or supply-chain injection.
npmCompromised packageAccount takeover - activecritical
ChainDrop npm Worm: Bun-loaded CI/CD credential harvester with Ethereum dead-drop C2
ChainDrop is a self-propagating npm worm that publishes malicious versions of dozens of npm packages using stolen maintainer credentials. The worm harvests CI/CD credentials and uses an Ethereum-based dead-drop command-and-control mechanism.
ChaindropnpmOtherCompromised packageMalicious maintainerAccount takeover - activehigh
keyv and cacheable npm Package Hijacked in Supply Chain Attack
Wiz Research identified an ongoing supply chain attack affecting multiple keyv and cacheable npm packages. The attack appears to involve package hijacking, with investigation ongoing to determine full scope and impact.
npmAccount takeover - containedcritical
Malicious code in @antv/gi-mock-data (npm)
The npm account `atool` was compromised and used to publish 631 malicious versions across 314 npm packages, including @antv/gi-mock-data, in a 22-minute automated burst. Each malicious version injects a preinstall hook executing an obfuscated Bun script that exfiltrates credentials and establishes persistence via CI/CD workflow injection and system daemons.
Mini Shai HuludnpmOtherAccount takeoverCompromised packageMalicious commit