On this page
Databricks Threat Research studied about 5,400 confirmed malicious npm packages that attackers published from December 2025 to October 2026. Their report is What 5,400 Malicious npm Packages Reveal about Software Supply Chain Risk in 2026(opens in new tab). It measures how long a malicious package stays installable before a public advisory warns users or npm removes it. This time is often days, and for some campaigns weeks. No security tool finds every malicious package the moment it is published. This post shows how to set up install-time defenses that protect a developer until someone finds and blocks the package. It is for developers and platform teams who install npm packages every day.
Key numbers from the Databricks report
- For packages that Databricks could not link to a named campaign, an OSV advisory appeared at a median of 1.7 days after publish. For packages linked to North Korea, the median was 4.5 days.
- npm took down 40% of the attacker-created packages, at a median of 7.1 days.
- npm took down 64% of the packages linked to North Korea, at a median of 19.5 days.
- 16% of the attacker-created packages were still installable when Databricks checked.
- Compromised legitimate packages were 7% of the set but received over 99% of the downloads.
- 46% of the packages declare no install script. Their code runs when a project imports or calls the package.
- 38% of the packages talk to a legitimate service, such as Cloudflare Workers, Telegram, Discord or a blockchain node.
The window between publish and removal
Most defenses act only after someone else acts. npm audit and most dependency scanners wait for an advisory. npm waits for a report and a review before it takes a package down. The Databricks report measured how long these waits last.
| Event after npm publish (Databricks data) | Median | Slow cases |
|---|---|---|
| OSV advisory, packages with no named campaign | 1.7 days | 10% took more than one month |
| OSV advisory, North Korea-linked packages | 4.5 days | 10% took more than two months |
| npm security placeholder, attacker-created packages | 7.1 days | 10% took more than 59 days |
| npm removal, North Korea-linked packages | 19.5 days | 16.4 to 65.9 days per campaign |
A developer who installs a package during this window gets the malware. Faster detection helps, but it cannot close the window for every package. A defense must hold while detection catches up.
Defense in depth at install time
PMG(opens in new tab) runs on the developer machine and in CI. It works with package managers such as npm, pnpm and pip, and the other package managers that PMG supports. It applies three layers to each install. Each layer covers part of what the layer before it can miss. PMG is free and does not need an account.
Layer 1: threat intelligence before the install
PMG checks every package version against SafeDep Threat Intel(opens in new tab) before the package manager downloads it. SafeDep analyzes new npm releases soon after the registry publishes them. This table shows recent examples of SafeDep detections of malicious packages. Each time runs from the npm publish to the SafeDep verdict.
| Release | What it did | SafeDep verdict after publish |
|---|---|---|
@ethersphere/bee-js@13.3.0 | A compromised release pipeline added a postinstall hook that runs remote code | 4 minutes |
tensorlake@0.5.144 | A worm that steals credentials and plants CI workflows | 8 minutes |
fastbcrypt@1.0.1 | A copy of bcrypt with a trojanized Windows binary | 8 minutes |
git-iss-creator@10.13.0 | Instructions that tell an AI coding agent to steal CI secrets | 10 minutes |
cache-manager@7.2.10 | A compromised release that steals AWS credentials | 11 minutes |
easy-day-js@1.11.22 | A dayjs impersonation that drops a remote access trojan | 14 minutes |
cacheable@2.5.1 | The same campaign, about 30 million downloads a month | 15 minutes |
SafeDep also shares what it finds. SafeDep has contributed more than 1,500 malicious package reports to OSV(opens in new tab), the open database that many security tools read. SafeDep’s threat intelligence also includes the OSV records, so PMG blocks a package that another researcher reports.
Layer 2: cooldown for new versions
The PMG dependency cooldown hides package versions that are less than two days old. The package manager then resolves an older version. A new package with only new versions does not install. The cooldown does not depend on any verdict. It gives detection time to work.
To test the window, SafeDep looked at 26 malicious releases of established packages from February to November 2026. Each package had months of history and earlier releases. The list has well known incidents, such as axios, node-ipc, jscrambler, keyv and tensorlake, and compromised packages from a random sample of OSV. The table counts how soon each release got its first malicious verdict from SafeDep or OSV.
| First verdict within | Releases |
|---|---|
| 1 hour | 10 of 26 |
| 6 hours | 18 of 26 |
| 24 hours | 22 of 26 |
| 48 hours | 23 of 26 |
For 23 of these 26 releases, a malicious verdict was on record before the default two-day cooldown ended. A developer behind PMG could not install them during the cooldown, and the verdict blocked them after it. It does not matter which source found them first. react-hook-form@7.73.0 is one example. The cooldown hides a new version for two days, and OSV listed this one as malicious 18 minutes after publish. Three releases took longer than 48 hours. Two of them were found at about 52 hours, and one took 25 days. A team that wants a wider margin can set a longer cooldown in the PMG configuration. The cooldown applies when the package manager picks a version from the registry metadata, which is the normal npm install flow. An install from an already resolved tarball URL, which includes some lockfile installs, skips the cooldown. The threat intelligence check still applies to that download.
Layer 3: a sandbox for the code that runs
When the first two layers miss, the package code runs. With the sandbox on, PMG runs the install, its lifecycle scripts and npm run scripts under an operating system sandbox. It uses Seatbelt on macOS, and Landlock with seccomp on Linux, with Bubblewrap as a fallback. The npm profile denies file access by default. It allows the project, system folders and the package manager caches. Everything else in the home folder stays closed.
The Databricks report lists the credential types that the stealers target. This table maps them to the sandbox.
| Credential type in the Databricks report | PMG sandbox |
|---|---|
| Cloud credentials | Denies .aws, .azure, .gcloud and .kube, and removes cloud credential variables such as AWS_SECRET_ACCESS_KEY from the environment |
| SSH keys | Denies .ssh and the SSH agent socket |
.env files | Denies .env and .env.* in the project and in the home folder |
| Cryptocurrency wallets and browser data | Denied, because the profile does not allow those folders |
| AI developer credentials | Removes API key variables for OpenAI, Anthropic, Gemini, Hugging Face and others |
| npm tokens | Not protected. npm must read ~/.npmrc and NPM_TOKEN to install. This is a documented trade-off |
Three releases from the first table show what the sandbox stops.
tensorlake@0.5.144reads cloud keys, SSH keys, browser cookies and wallet data. It writes.github/workflows/run-copilot.ymland.vscode/tasks.json, and it installs a systemd or LaunchAgent service. The sandbox denies those reads, those two project paths and writes outside the project.cache-manager@7.2.10reads AWS credentials. The sandbox denies.awsand removes theAWS_*variables.@ethersphere/bee-js@13.3.0downloads code fromapi.frameworkmetrics[.]xyzand runs it. PMG tells Node to send its HTTP traffic through the PMG proxy. The npm profile allows only the npm registries, GitHub and nodejs.org. Withnetwork_mode: enforce, the proxy refuses this download.
The sandbox has limits, and they matter.
- npm tokens stay readable, as the table shows. Databricks found that npm token theft peaked at 22% of packages in March 2026.
- The sandbox does not yet deny writes to
.claudeor.cursorinside the project. tensorlake writes.claude/settings.json. - The Bubblewrap fallback on Linux skips a deny rule for a path that does not exist yet. In a project with no
.github/workflowsfolder, a package can create one. network_modeisauditby default. Audit mode records a connection to an unknown host and lets it through. Setenforceto refuse it.- The proxy sees only the traffic that uses it. Code that ignores the proxy settings can connect directly. A profile with
network_via_proxy_onlyblocks direct connections on Seatbelt and Landlock. The npm profile does not set it by default. The Bubblewrap fallback cannot block one host and allow another. - The sandbox covers commands that run through PMG. A program that you start directly, such as
node server.js, runs outside it.pmg sandbox exec -- <command>runs any program under the sandbox.
Hijacked packages carry the real risk
Attacker-created packages are 89% of the Databricks set but only 0.2% of downloads. Compromised legitimate packages are 7% of the set and over 99% of downloads. Databricks found that 78% of compromised versions add or change a lifecycle script, and 23% show a maintainer or publisher change.
A provenance attestation does not prove that a release is safe. Databricks found that 85% of malicious packages published through trusted publishing are compromises, and it advises teams to “treat trusted publishing as provenance, not assurance.” The August releases of cache-manager and cacheable kept their OIDC and SLSA attestations, because the attacker published them from the project’s own CI.
No single check catches every hijacked release. The layers work together. The threat intelligence blocks a known release. The cooldown holds a new release while the community and SafeDep analyze it. The sandbox limits what a release can take if both miss.
What a fake package looks like
Databricks gives a clear profile of an attacker-created package.
- 88% are less than 30 days old at publish, and 81% have no downloads.
- 75% declare no repository. Of the packages that name an author or a repository, about 80% name someone other than the publisher.
- 17% have an internal-looking name, such as
core,utils,sdkorconfig. One dependency confusion campaign made 78% of the confirmed versions in August 2026. - 13% put a popular package name inside their own name. Fewer than 5% are within two character edits of a popular name.
On the developer machine, PMG blocks known malicious packages, and the cooldown stops a new package in its first two days. In pull requests, the vet(opens in new tab) v2 GitHub Action flags the same profile.
| Profile in the Databricks report | vet control |
|---|---|
| New, with few downloads | new-unpopular-package |
| Claims a repository it does not own | starjacking |
| Internal name on the public registry | dependency-confusion, with your private names in internal_names |
| One typo away from a popular name | typosquat |
The typosquat control checks names that are one typo away from a popular package. It does not flag a popular name inside a longer name. Those packages are usually new and unpopular, so new-unpopular-package flags them. SafeDep has written about several dependency confusion campaigns.
The Databricks recommendations, mapped to SafeDep
| Databricks recommendation | SafeDep control | Not covered |
|---|---|---|
| Install-script blocking is partial. Add lockfile integrity and a proxy with a minimum-age policy | PMG proxy with threat intelligence and cooldown. vet integrity-changed and registry-path-mismatch | |
| Monitor lifecycle-script changes between versions | vet install-scripts-added and script-hook-added in pull requests | |
| “Restrict credentials available to build environments” | PMG sandbox removes credential variables and denies credential files | Short-lived, job-scoped credentials are a CI setting |
| “Treat trusted publishing as provenance, not assurance” | vet provenance-lost, unpinned-action and the Actions lockfile check. PMG threat intelligence and cooldown | A release from a compromised CI keeps its provenance |
| “Do not rely on domain reputation for build-time egress control” | PMG sandbox network allow list with network_mode: enforce | Code that ignores the proxy needs network_via_proxy_only. Bubblewrap cannot filter by host |
| “Register organizational scopes on the public registry” | vet dependency-confusion | Scope registration is a registry task |
| “Protect AI assistant configuration as a credential store” | vet endpoint audit reads agent and editor configuration files. Gryph(opens in new tab) audits coding agent actions. pmg sandbox exec runs an agent under the sandbox | PMG does not yet deny project writes to .claude or .cursor |
| “Prepare for agent-operated intrusions” | Gryph keeps an audit trail of agent actions | Canary credentials and SOC detections |
What to do this week
- Install PMG and run
pmg setup install, so that everynpm installgoes through it. See the PMG quickstart(opens in new tab). - Turn on the sandbox and set
network_mode: enforce. - Keep the cooldown on. It is on by default, with a two-day window.
- Run
vet ci initin each repository. It adds the vet v2 GitHub Action, which fails a pull request that adds an attack. Make thevetjob a required check. See the vet GitHub Action guide(opens in new tab). - Set
internal_namesin the vet configuration, so thatdependency-confusionknows your private package names.
References
- What 5,400 Malicious npm Packages Reveal about Software Supply Chain Risk in 2026(opens in new tab), Databricks Threat Research, 23 November 2026.
- OSV malicious package records(opens in new tab), Open Source Vulnerabilities.
- PMG dependency cooldown, SafeDep.
- tensorlake 0.5.144 npm compromise, SafeDep.
- keyv and cacheable npm compromise, SafeDep.
- Compromised bee-js and Swarm Desktop, SafeDep.
- supply-chain
- malware
- npm
- pmg
- vet
- defense-in-depth