Slopsquatting explained
Sometimes your AI assistant suggests a package that doesn't exist. If someone registers that name first, the next npm install runs their code. This is called slopsquatting. Seth Larson of the Python Software Foundation coined the term for supply chain attacks built on AI package hallucinations.
QUICK CHECKLIST
- Look up every new package on npmjs.com or pypi.org
- Check its age, author, downloads and repo link
- Be wary of names one letter off a famous package
- Pin versions and commit the lockfile
How often AI makes up packages
A USENIX Security 2025 paper by Spracklen et al. tested 16 code models on 576,000 code samples. Of 2.23 million recommended packages, 440,445 (19.7%) didn't exist, which came to 205,474 unique fake names. Commercial models averaged 5.2% and open-source models 21.7%. JavaScript code had more fake packages than Python (21.3% vs 15.8%).
How a slopsquatting attack works
npm runs a package's preinstall and postinstall scripts by default, so the code doesn't even need to be imported. The attacker's package can read your .env or your SSH keys during install.
It already happened
In late 2023, Bar Lanyado of Lasso Security noticed AI models kept recommending huggingface-cli as a pip package. The real tool is installed with pip install -U "huggingface_hub[cli]". He uploaded an empty package under the fake name. It got more than 30,000 real downloads in three months, and an install line for it showed up in the README of an Alibaba research repo. His package was harmless. An attacker's wouldn't have to be.
Slopsquatting vs typosquatting
| Typosquatting | Slopsquatting | |
|---|---|---|
| Who makes the mistake | A person typing a name | An AI suggesting a name |
| What the fake name looks like | One letter off: reqeusts | Plausible but invented: huggingface-cli |
| How attackers pick names | Common typos of popular packages | Names models suggest again and again |
Signs of a made-up package
- The name isn't on npm or PyPI at all (the install fails, and your AI suggests a "fix").
- It exists but was first published days or weeks ago.
- It has almost no downloads, no linked repo, or a name that's one letter off a famous package.
- Your AI is confident, but the package's docs don't mention the function it told you to call.
How to check a package before you install it
Look it up
Open the package on npmjs.com or pypi.org before installing. Check its age, author, weekly downloads and source repo.
Pin and lock
Pin versions and commit your lockfile, so a new release can't slip in.
Ask for the source
Ask your AI to name the official package and link its repo, then open that link yourself.
List every dependency in package.json and requirements.txt. For each one, tell me the official registry page and source repo. Flag anything you can't verify, anything first published in the last 30 days, and anything one letter off a popular package.
How Leakcade checks this
We read your manifests as text and look up each name on npm and PyPI (only those two hosts, nothing is installed). Names that don't exist are flagged high; packages younger than 30 days are flagged medium.
If every name exists and none is brand new, the check stays quiet and Drip stays happy.
Further reading
- Spracklen et al., USENIX Security 2025 (PDF)
- Lasso Security: AI package hallucinations
- The Register: AI bots hallucinate software packages
FAQ
What is slopsquatting?
An attack where someone registers a package name that AI coding tools invent, so developers who follow the AI's suggestion install the attacker's package.
How is slopsquatting different from typosquatting?
Typosquatting bets on people mistyping a real name. Slopsquatting bets on AI models suggesting the same fake name again and again.
Can a package run code just by being installed?
Yes. npm runs preinstall and postinstall scripts by default. You can turn them off with npm install --ignore-scripts, though some packages need them to build. If a bad package did run, treat every key in your .env as leaked.
Which AI models make up the most packages?
In the USENIX 2025 study, open-source models averaged 21.7% hallucinated packages and commercial models 5.2%. No model in the study was at zero.
Want a second pair of eyes?
We review your whole repo and write a fix prompt for every finding. $19, report within an hour.
Check my repoLeakcade is an automated check. It can miss vulnerabilities and is not a substitute for a professional security audit or pentest. Provided as is. You stay responsible for your code. Where the law allows, our liability is limited to what you paid ($19). Terms