Slopsquatting: how hallucinated package names become a supply chain attack
AI assistants sometimes suggest packages that do not exist, and attackers register those names. How slopsquatting works and how to keep it out of your lockfile.
Slopsquatting is a supply chain attack where someone registers a package name that AI assistants tend to invent, then waits for developers to install it on the assistant's advice. Defend against it by verifying every new dependency before install: the package must exist, be the intended one, have a real maintainer and history, and be spelled exactly right. Review lockfile changes on every pull request.
- Assistants can confidently recommend packages that were never published.
- Typosquatting and slopsquatting both rely on nobody checking the name.
- A lockfile review and a short dependency policy close most of the risk.
Ask an assistant how to parse a format, and it may suggest installing a library with a sensible name. Sometimes that library is real. Sometimes it never existed: the model assembled a plausible name from fragments of real ones.
If nobody has registered that name, the install fails and you move on. The risk is when someone has.
How slopsquatting works
- Assistants repeatedly suggest the same non-existent package names for common tasks.
- An attacker collects those names and publishes packages under them.
- A developer, trusting the suggestion, runs the install. The package executes an install script or ships malicious code into the app.
It is the same idea as typosquatting, which relies on typing mistakes, but the names are generated by the model, so they can look entirely legitimate.
Where it shows up in a codebase
- A dependency added in the same commit as the code that uses it, with no discussion.
- A name one or two characters away from a popular library.
- A package with very few downloads, a recent first publish and no linked repository.
- An import in code for a package that is not in the manifest at all, which is the hallucination before anyone installs it (AID-01).
Defences that work
A dependency policy in your AI tool rules
Add a rule: do not add a dependency without stating why, and prefer libraries already in the project. Assistants are much less likely to invent packages when told to reuse existing ones.
Verify before install
For each new package, check:
- It exists on the official registry and the name matches exactly.
- The repository link points to a real project with history.
- The maintainer and publish history make sense for its age.
- Downloads are in line with how popular the assistant implied it was.
Review lockfile changes
Treat changes to package-lock.json, pnpm-lock.yaml, poetry.lock or requirements.txt as code. A one-line addition deserves the same attention as a new endpoint.
Scan continuously
Run a dependency scanner on every change for known vulnerabilities, and flag new direct dependencies for review. The dependency CVE scanning guide covers tooling.
Disable install scripts where you can
Package managers can skip lifecycle scripts by default. Where your stack allows it, opt in to scripts per package instead of trusting all of them.
If you find one
Remove the package, rotate any secrets present on machines or CI runners where it was installed, check build logs for unexpected network calls, and report it to the registry.
This is checklist item DEP-02, rated Critical by default, and we check every lockfile change for it every night.
Frequently asked questions
What is the difference between typosquatting and slopsquatting?
Typosquatting targets human typing mistakes, such as a swapped letter. Slopsquatting targets names that AI models invent or misremember, which can look entirely plausible.
Does npm or PyPI protect against this?
Registries remove known malicious packages and block some lookalike names, but new registrations happen constantly. Verification on your side is still needed.
How do I check a package quickly?
Open the registry page, confirm the repository link, maintainer, publish history and weekly downloads, and compare the name character by character with the library you meant.
Want to know what your repo would show?
Send one public repo. We reply with three verified findings and the prompts to fix them. No call needed.