NewThe Mac app is out for Apple SiliconGet it →
Fenzi
blog, safety

What is slopsquatting?

Slopsquatting is registering a package under a name that AI models tend to invent, so that the next person or agent who installs that name runs the attacker's code. It is typosquatting, with the typo made by a model instead of a person. AI coding agents raise the odds because they often run the install command themselves, and the package's install script runs with whatever the agent can reach.

By Boris Kwemo, , six-minute read

The word joins AI slop and typosquatting. Typosquatting waits for a person to mistype a real package name. Slopsquatting waits for a model to write a name that sounds right and does not exist, then claims that name on npm or PyPI first.

How the attack works

It takes three steps, and only the second one needs an attacker. A model suggests a package that is not on the registry. Someone registers that name and puts code in it.

Then a later run of a model suggests the same name, and someone installs it. The install succeeds, because the package now exists. Nothing looks wrong: no error, no typo, a name that fits the task.

The attack works only if invented names repeat. A name a model writes once and never again is worth nothing to an attacker. A name that several models write for the same kind of task is a name worth claiming.

Why AI coding agents change the odds

When a chatbot suggests a package, a person still has to copy the name into a terminal. An AI coding agent writes the import, adds the dependency and runs the install in one turn. The person who might have noticed the name is often reading something else.

Package managers assumed that person was there. npm's npx documentation says it prompts before installing anything, to prevent problems from mistyped names. The same page says that prompt is skipped: "When standard input is not a TTY or a CI environment is detected, --yes is assumed." A command an agent runs in CI, or without a terminal attached, installs without asking.

Installing is also running. npm runs a package's preinstall, install and postinstall scripts during the install, as its scripts reference lists. A malicious package does not need you to import it. It runs as the agent, with the agent's files, environment variables and network.

The names also come from text the agent reads

A model does not have to invent the name on the spot. react-codeshift appears in npx commands inside instruction files written for agents, and a code search on GitHub still finds many copies. Its registry record has one version, created on 14 January 2026 by Aikido Security as a "Placeholder to prevent dependency confusion."

That makes it a cousin of the prompt injection examples in vendor advisories. Nobody has to trick the model. A README, a skill or an issue names a package, and the agent installs what the text says.

"Our agent only installs packages we already use."

Revision 1: it installs the names it reads and the names it writes, and a model can write a name nobody has published yet.

What the research shows

Trend Micro published a slopsquatting dataset built from 100 web development tasks. It records which dependencies each model or AI coding agent chose, and which of those names the registry did not have. The rows include runs labelled as the Claude and Codex command-line agents, next to plain model calls.

The README sums up the two mitigations it tested. Agents that reason and search the web made up fewer names, and checking each name as it was written, through an MCP tool, left the fewest.

Neither approach fully eliminates the threat of AI-generated malicious packages.Trend Micro, slopsquatting dataset

Some names in that dataset have since been claimed. opentelemetry-instrumentation-litestar appears in a row labelled as the Claude command-line agent, and the task text never names it. Its PyPI record shows a package uploaded on 21 February 2026 with the summary "Benign slopsquatting research package."

NameWhere it came fromWhat is on the registry now
react-codeshiftnpx commands in instruction files for agentsAn npm placeholder, 14 January 2026
opentelemetry-instrumentation-litestarDependencies chosen for a dataset taskA PyPI research package, 21 February 2026

Both names were claimed by people studying or blocking the risk. The point is that each one was free to claim, by anyone, after models had already written it.

How to defend against it

Ask before installs. Make every install command a question, even when other commands run freely. In Claude Code an ask rule does that, and the permissions page says ask rules apply when any part of a compound command matches, even in auto mode.

{
  "permissions": {
    "ask": ["Bash(npm install *)", "Bash(npx *)", "Bash(pip install *)", "Bash(uv add *)"]
  }
}

When the prompt comes, look the name up before you approve it: a package created last week, with one version and no source repository, needs a reason. Our notes on how Claude Code permissions work cover what such rules match and what they miss.

Install from a lockfile. npm ci installs exactly what package-lock.json says and fails if package.json disagrees. pip's secure installs page recommends --require-hashes, which refuses any requirement without a pinned hash. A new name then has to come through a diff someone reads.

Wait before you trust a new release. A name registered last night should not be installable this morning. Three package managers can enforce that wait:

ToolSettingWhat it does
pnpmminimumReleaseAgeMinutes a version must have been published before it installs; the docs list 1440, one day, as the default
npmmin-release-ageInstalls only versions published more than the given number of days ago
uvexclude-newerTakes a date or a duration such as 1 week

Do not run install scripts by default. pnpm's build settings say packages not listed in allowBuilds "are disallowed by default." npm has ignore-scripts and an allowScripts list in the config reference linked above. For Python, pip's page suggests --only-binary :all:, which refuses source distributions, the kind that build on your machine.

Limit what a bad install can reach. None of the above is perfect, so assume one bad package gets through. If the agent runs where its process finds no long-lived keys and can only reach a short list of hosts, a malicious install script has little to take and nowhere new to send it. That is the same reasoning as our AI agent security risks answers, and the four rules of agentic AI security: directories, hosts, keys, and a person who approves more.

A side note on how we do it

We build Fenzi, which starts the agent inside an OpenShell sandbox with a copy of the project and a placeholder instead of the real key. Its default policy lets the agent read npm and PyPI, so it does not stop a bad name from installing; it limits what that package's code finds and where it can send, as the default access sheet lists. A container or a virtual machine with a short host list does the same job.

So, what should you do about it?

Treat a package name from a model, or from a file the agent read, as unverified input. Make installs ask, install from lockfiles in CI, turn on a release cooldown and keep install scripts off unless a package needs them, then run the agent where one bad install costs a diff, not a key. Your package manager's own settings reference, such as pip's secure installs page or pnpm's dependency resolution settings, is the next place to read.

One line to install.
One command to run.

curl -fsSL https://fenzi.dev/install.sh | sh

Then fenzi run claude. Ask it to open a pull request with the GitHub API, and watch the deny land.