npm Trusted Publishing vulnerability: 1,500 Packages at Risk

The npm Trusted Publishing vulnerability exposed 1,500 packages to takeover via GitHub slug reclaim. Audit your OIDC bindings now.

A developer in a gray sweater sits at a wooden desk in a home office, typing on a laptop beside a smartphone, notebook, and coffee mug.

A package takeover that needed no stolen credentials

Bloom Security named their research SlugFest, and the numbers are uncomfortable: more than 1,500 npm packages, over 10 million combined downloads, exposed through a single weak link in the npm Trusted Publishing vulnerability. Their full write-up is on HackerNoon (opens in new tab), and I would read it before touching your own publisher settings.

The flaw in one sentence: npm bound publish trust to a GitHub repository’s slug (the owner/repository address you type into a browser) rather than to GitHub’s permanent numeric repository ID.

That difference is the entire bug. A slug is a rental. Rename the repo, transfer it to another organization, or delete it, and the old address goes back into circulation for anyone to claim. The permanent ID does not move. So if a package’s Trusted Publisher binding still points at a slug that has been freed, and that package has never completed a successful publish, whoever claims the address can publish under the real package name. No npm account stolen. No GitHub account stolen. The attacker never authenticates as the maintainer at all.

It works a bit like an old mail forwarding order. You tell the post office that anything arriving at your previous address should come to you. Then you move out, someone else rents the unit, and the forwarding order is still active. Mail keeps flowing because the system is matching an address, not an identity.

Those 1,500 packages come from Bloom’s registry-wide scan of packages specifically configured for Trusted Publishing, not the npm registry as a whole. That is a narrower set, and it is the reason to check whether you are inside it rather than to panic broadly.

Why this landed on my desk is mundane. I run VPS boxes for customers, and their pipelines and coding agents install whatever dependencies they decide they need. I do not read those package names. On a normal day I would not notice a new release of a library I have never imported myself, which is exactly the profile this attack is built around. The agent resolves it, installs it, and if there is a postinstall hook, the code runs.

What I cannot verify from the public reporting so far: how wide the exposure window really is across the affected set, and whether npm has finished rebinding trust to immutable repository IDs on their side.

Background: how npm Trusted Publishing hands out publish rights

Trusted Publishing was npm’s answer to a problem that had been festering for years. Automation tokens are long-lived strings that sit in CI secrets, get copied into other repositories, and outlive whoever created them. Under the trusted publisher model, a GitHub Actions workflow requests a short-lived OpenID Connect token from GitHub, exchanges it with npm, and receives publishing credentials that expire in minutes. There is nothing durable to steal, and the workflow file itself becomes the thing being trusted.

Setting it up means opening your package’s settings on npmjs.com, choosing GitHub as the provider, and entering a workflow filename alongside an owner and repository pair. That pair is the slug. It looks like someorg/some-project. It reads like an identity. It is not one. The slug is a display name GitHub lets you change, and the moment it changes, the old string goes back into circulation for anyone to register.

GitHub does maintain a permanent numeric repository ID that survives renames and ownership transfers. That is what the binding should have referenced from the beginning. npm went with the readable address instead, and this entire class of exploitation grows out of that single design decision.

A stale binding on its own does nothing, which is why the attack needs two things at once. The trusted publisher entry has to still name a slug nobody currently holds, and the package has to have no successful publish behind it. That second condition is not arbitrary. Once a package has shipped a real version, npm has a record of the legitimate publish, and reclaiming the address stops opening the same door. So the exposed group sits in a narrow slice: packages set up for Trusted Publishing, pointed at a repository slug that has since moved, where a first release never landed.

What an attacker actually inherits is worth stating plainly, because it is smaller than people assume and still bad enough. They do not get your npm account. They cannot open your other packages, read your tokens, or change your billing. They get the ability to push a version that carries your package name and your existing download history. Dependents resolve on the name and version range, not on who signed the tarball, so that is sufficient.

What’s happening now: SlugFest and the 1,500 packages

Bloom published its findings under the name SlugFest, and the headline number is 1,500-plus vulnerable npm packages carrying more than 10 million combined downloads, over a million of those per month. Those figures come from the write-up on HackerNoon covering Bloom’s research (opens in new tab), and the important qualifier is that the count covers packages configured for Trusted Publishing, not the registry as a whole. The registry has millions of packages. This is a slice of it, but a slice full of packages that other code already depends on.

To prove the mechanism rather than describe it, the researchers set up two GitHub repositories in different organizations that ended up sharing the same slug, after the original address was freed. They published a version of the target package from the second repository. No stolen credentials, no npm account takeover, just a repository address that happened to be available. That is the demonstration, and it is unglamorous in the way that real supply chain problems usually are.

Bloom also blocked an attempt on a real customer endpoint, where an AI coding agent tried to install a package exposed to this issue. That detail matters more than the demo. A proof of concept in a lab is a finding. An agent reaching for one of these packages on someone’s machine during ordinary dependency resolution is a near miss.

The install volume behind that near miss is the part that should worry anyone running a fleet. Bloom measures roughly 70 agent-installed packages per endpoint per month, approaching 350 on developer machines, with individual agents pulling between 0.3 and 1.2 packages daily. Developer machines see two to three installs a day across five or more agents. None of that counts transitive dependencies.

What I cannot verify from the public reporting is npm’s side of the timeline. The research notes the vulnerability stayed exploitable for more than 120 days after disclosure, which is a long window, but the write-up does not say what registry-side changes landed, when, or whether the reclaim path is closed now. Until that is clear, the honest position is that your own bindings are the only thing you control.

What the npm Trusted Publishing vulnerability means in practice

Can someone publish a malicious version of my package without my npm or GitHub credentials?

Yes, if two conditions hold at the same time: your Trusted Publisher binding still names a GitHub slug that anyone can now claim, and your package has never had a successful publish. Both have to be true. Remove either one and this path closes. What matters is that the attacker never authenticates as you. They claim a repository address that your binding already trusts, and npm issues publish rights to the package name you own. On your side nothing looks stolen, because nothing was.

Does 2FA or a scoped npm token stop it?

Neither is in the path. 2FA protects your npm account login. A scoped token protects whatever that scope was minted for. This is a trust-binding flaw sitting upstream of both, which is why the usual advice about rotating tokens and enabling 2FA does nothing here. I have watched people assume that enforced 2FA across the registry means publishing is locked down. It removes the stolen-credential class of takeover. This is a different class.

My repo was never renamed or deleted, so am I safe?

Probably, and probably is the honest word. The failure needs the slug to have been freed at some point, and freed slugs come from quieter histories than most maintainers remember. A repo transferred to a new GitHub organisation during a rebrand. A mirror deleted in a cleanup. A name that was squatted years ago and later reused by a legitimate project. A package that changed owners without anyone updating the trusted publisher config. This has the same shape as a hosting customer who lets a domain lapse, and old DNS records elsewhere still point at that address while someone else answers on it. Go through every binding and compare the slug against the repository that exists today rather than against your memory of it.

Do AI coding agents actually change the risk?

They remove the step where a person reads the package name and the diff before it lands. The exposure was always present; what moved is the volume and the absence of review. Roughly 70 agent-installed packages land on an average endpoint each month, and the agent resolves dependencies the way a tired developer would at 1am, except it never gets tired and never gets suspicious about a version bump. If a postinstall hook fires during that resolution, it fires on your machine or inside your CI.

What to expect next

The correct fix is not hard to describe. Publishing trust should be bound to GitHub’s numeric repository ID, which survives renames and transfers and is never handed out again, rather than the owner/name string that anyone can reclaim. GitHub exposes that ID through the API, and it stays the same for the life of the repository. npm has every reason to move, because the alternative is a permanent class of packages whose publish trust points at an address a stranger can claim.

The migration is the messy part. Every trusted publisher binding in the registry today stores a slug. Switch matching to ID-only and thousands of maintainers have to go rebind, and the ones who miss the announcement quietly lose the ability to publish from CI. I have broken release pipelines with changes far smaller than that. Expect a deprecation window, a warning banner in the npm package settings page, and a long tail of projects frozen on the old binding because nobody reads the npm changelog until a release fails at 11pm the night before a launch.

Closing the reclaim window sits on the registry side. A rule that refuses to register a trusted publisher until the package has at least one successful publish would kill the second condition outright, and it costs almost nothing to implement. Invalidating a binding when the referenced slug stops resolving is the harsher version. I do not know which route npm takes, or whether it validates the repository ID at bind time instead and leaves existing configs alone.

My expectation, and it is a guess rather than anything sourced, is that the exploitation looks like scanning instead of one loud incident. Bloom reported the issue stayed exploitable for more than 120 days after disclosure, which is more than enough time for someone to write a script that walks released GitHub slugs and cross-references them against trusted publisher configurations. That pattern produces a handful of malicious versions on packages with tiny download counts, and those are precisely the packages nobody diffs. A dramatic incident would honestly be the better outcome, because it would force the migration through in a week.

Two things I genuinely cannot answer from the public reporting: how many of the 1,500 flagged packages have been remediated since the disclosure, and whether anyone published a malicious version before Bloom arrived. If you maintain one of them, the lack of an incident report is not proof that nothing happened.

Check your trusted publishers this week

Start with the list. On npmjs.com, open each package you own, go to Settings, then Trusted Publisher, and read the owner/repository string sitting in that field. If your npm CLI is current enough to have the trust subcommand, npm trust list <package> gets you the same answer without the clicking. Write the slug down beside the package name. Then open that repository on GitHub and check two things, whether it still exists and what owner prefix it carries today. A binding pointing at oldco/payments-sdk while the repo now lives at newco/payments-sdk is a live hazard, unless the old prefix got claimed by one of your own organizations.

If a repo moved, got transferred, or was deleted, and the package has never had a successful publish, you have two ways out. Rebind the trusted publisher to the current slug, or push a real version. The publish is the more durable fix because it removes the second condition entirely, so the binding stops being claimable no matter what happens to the address later. Maintaining a package with no release worth shipping? Cut a patch with a README typo fix. It is silly and it works.

Then add the check that actually catches this class of problem. Store the GitHub repository’s numeric ID somewhere in the repo, pull it with gh api repos/$GITHUB_REPOSITORY --jq .id, and fail the pipeline when the live value stops matching the stored one. Slugs get reused by strangers. IDs do not. That step took me about ten lines and it flags a transfer before anyone at npm notices.

Agents need their own guard rail, because they install without asking. I set ignore-scripts=true in the global npmrc on my own boxes and opt back in per project, which breaks roughly one package in twenty and I have decided that trade is worth it. Committing lockfiles and running npm ci instead of npm install matters too, since an agent that resolves fresh semver ranges will cheerfully land on a version published four minutes ago by someone you have never heard of.

Pick the package on your list with the highest download count and go read its trusted publisher field right now.