sw-pluginer@1.2.0
Malicious code in sw-pluginer (npm)
Analysis
sw-pluginer@1.2.0 is a Tailwind CSS plugin that turns a build-time config load into remote code execution on the developer's machine. Adding the advertised `require('sw-pluginer')` to tailwind.config.js invokes the exported factory in index.js, which reads `node_modules/.bin/manifest.json`, takes its `path` field as a URL, deletes that manifest file immediately (lib/manifest-reader.js calls fs.unlinkSync), downloads the script at that URL over http/https via lib/worker-fetcher.js — accepting any response whose Content-Type contains "javascript" or "text/plain" — and then executes the downloaded body with eval() inside lib/register-worker.js::generateRegistration. There is no allowlist, host restriction, signature or integrity check on the URL or the fetched code, so whoever can place that manifest file determines what code runs with the developer's privileges during the build. The eval is disguised: the function is documented as "safe, no eval", and the README describes the package only as service-worker registration and an offline-PWA update banner. The fetched URL is not fixed in the package — index.js builds its path from process.cwd() plus node_modules/.bin/manifest.json, so the second stage is attacker-supplied rather than hardcoded. The same remote URL is also interpolated into emitted client-side service-worker registration snippets (lib/sw-update-prompt.js), and the package ships no network IOCs of its own beyond that manifest-supplied URL.
- analyzed by
- Leitwacht
- first seen
- Nov 17, 2026, 03:35 PM
- analyzed
- Nov 17, 2026, 07:08 PM
- weekly installs
- 126
Related advisories
- sw-pluginer@1.0.0 same package
- sw-pluginer@1.1.0 same package
Independently detected by the Leitwacht supply-chain probe. IOCs are defanged. Published CC0. Think this is a mistake? See the dispute policy.