Ask a coding assistant to parse a niche file format and it will sometimes tell you to run npm install on a package that has never existed. It sounds plausible, the name fits the job, and the install command is formatted perfectly. If the name is unregistered, the install fails and you move on. If somebody registered it last week, the install succeeds.

That second case is what people have started calling slopsquatting, a cousin of typosquatting where the misspelling comes from a model and not a tired typist. I'd put it on your list of problems to look at before it becomes a headline, because the cost of checking is an hour and the cost of ignoring it is somebody else's code running in your build.

How common is the invention?

The best evidence I know of is a paper presented at USENIX Security 2025, "We Have a Package for You!". The authors tested 16 code-generating models on Python and JavaScript tasks, producing 576,000 code samples. They found hallucinated packages in at least 5.2 percent of cases for commercial models and 21.7 percent for open-source models, and counted 205,474 unique invented package names across the whole experiment (USENIX paper). The attack the authors describe depends on a model inventing the same name again and again, since an attacker then only has to register that one name and wait. The paper's mitigation experiments reduced the rate while keeping code quality, which suggests the problem is manageable with care.

What the paper doesn't show is that attackers are exploiting this at scale, and I'm not citing a case where they did. I'm treating it as a documented weakness with an obvious payoff for an attacker, which is the sort of thing that tends to get used. That's my judgment, so weigh it accordingly.

The wider backdrop is real. Verizon's 2026 breach report says vulnerability exploitation is now the leading way into organizations at 31 percent of breaches, and that breaches involving a third party reached 48 percent of the total (Verizon). Your dependencies are a third party you installed yourself.

Three different problems with one fix list

It helps to separate the ways a package can hurt you, because the defences differ.

The first is the invented name just described. A package that never should have been on your list is now on it, because someone pasted a command without checking.

The second is a real, trusted package that ships a bad version. A maintainer's account is taken over, or a release process is abused, and a new version appears containing something nasty. This is the more familiar kind, and the damage happens in the window between publication and discovery.

The third is quieter. Your build resolves dependencies loosely, so what you test on Monday is not what you deploy on Friday. A version range, a missing lockfile, or latest in a manifest lets an unreviewed release into production without anyone deciding it should.

Check your own list this week

I wrote a small script for the first problem and for part of the second. It reads a package.json, and for each dependency it asks the public npm registry when the package was first published, how many maintainers it has and how many downloads it had last week. It flags anything missing from the registry, younger than 90 days, with fewer than 500 weekly downloads, or with a single maintainer.

I ran it on a test file containing Express, one of my own packages and a name I made up. This is the actual output:

ok express first published 2010-12-29 (5817 days), 198912592 downloads last week, 5 maintainer(s) CHECK gatewayproof first published 2026-09-15 (78 days), 12 downloads last week, 1 maintainer(s) <- younger than 90 days, under 500 downloads last week, single maintainer MISSING zzz-not-a-real-pkg-48213 (not on the registry: a typo, a private name, or a hallucination) 

Notice that it flagged gatewayproof, which is mine, a small tool with one maintainer that is under 90 days old on npm. That's the right behavior. The flags are prompts for a human to look, not verdicts. An unknown young package with one maintainer and a dozen downloads may be fine, and you should still be able to say why you chose it. The script is about forty lines of plain Node and needs no install, so it's easy to read before you run it.

You can do the same by hand for any package. npm view some-package time.created maintainers prints the first publication date and who can publish, and https://api.npmjs.org/downloads/point/last-week/some-package returns weekly downloads. Look at the repository link as well, and check that the repository exists, has history and matches the package.

For the third problem, two quick commands tell you a lot. grep -nE '"(\*|latest)"' package.json finds dependencies with no version constraint at all. And in your CI configuration, look for npm install. In a pipeline you almost always want npm ci, which installs exactly what the lockfile says and fails if the lockfile and manifest disagree. Confirm the lockfile is committed.

Three settings that reduce the exposure

Delay new releases. The pnpm documentation notes that malicious versions are usually found and removed from the registry quickly, in most cases within an hour, and offers a setting that refuses to install versions younger than a given age. The default is 1,440 minutes, one day, and you can raise it, for example to 10,080 for a week (pnpm docs):

# pnpm-workspace.yaml minimumReleaseAge: 4320 # three days, in minutes minimumReleaseAgeStrict: true 

GitHub's Dependabot has the same idea. Since a July 2026 change it waits three days by default before opening a version-update pull request for a new release, never delaying security updates, and you can lengthen it per dependency or by update type (GitHub docs):

# .github/dependabot.yml version: 2 updates: - package-ecosystem: "npm" directory: "/" schedule: interval: "weekly" cooldown: default-days: 7 semver-major-days: 30 

Review every new dependency, not only upgrades. Add a line to your pull request template that says "If this adds a package, why this one, and what did you check?" A person who has to type the answer will usually open the registry page first. That one habit would stop most invented names.

Constrain what AI tools may do. A coding agent that can run npm install unattended is a very efficient way to acquire a hallucinated package. Let assistants propose changes to package.json, and let a person or a reviewed pipeline run the install. This is the same permission thinking as in my piece on rolling out agents safely: the model can ask, and the system decides.

For installs in environments that handle secrets, consider npm ci --ignore-scripts, which skips the install-time scripts packages can ship, and then run only the build steps you trust. Some packages need their scripts, so test before you make it a rule.

A worked example

A six-person team asks an assistant for help generating invoices as PDFs from a niche accounting export. The assistant suggests acct-export-pdf and the developer installs it without a second look. Running the check on that package.json the next day, the script prints that it was first published nine days ago, with 31 downloads last week and one maintainer. A look at the repository finds a README copied from another project and a postinstall script that makes a network call. That's an invented example of what the check is for, and the shape is realistic. The team removes the package, finds the real library everybody uses for this, and adds the pull request question so the next person has to justify the choice.

The cost to the team was ten minutes. The cost of a package with a postinstall script running on a developer laptop that holds cloud credentials is a longer conversation.

What to do this week

  1. Run the check script, or the manual npm view commands, on every package.json in your main repositories. Investigate everything flagged, and delete what you can't justify.
  2. Search for unconstrained versions with the grep above, and pin or constrain them.
  3. Make sure a lockfile is committed in every repository and that CI uses npm ci or the equivalent for your package manager.
  4. Add a cooldown. Use minimumReleaseAge if you use pnpm, and a cooldown block in dependabot.yml for everyone else on GitHub.
  5. Add the "why this package" question to your pull request template.
  6. Write down which AI tools in your company can install packages on their own, and take that ability away or require approval.
  7. Put a calendar reminder to rerun the check every month. Dependencies change even when your code doesn't.

If you'd like help adapting the script to Python, Go or Rust registries, or reviewing how your CI resolves dependencies, I'm happy to take a look.

Michael, ArkNet Digital (https://www.arknet.digital)