LEAKCADE

Slopsquatting explained

Updated 3 min read

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

How a slopsquatting attack worksAn AI suggests a package name that doesn't exist, an attacker registers it, a developer installs it, and the attacker's install script runs.AISuggests apackage thatdoesn't existATTACKERRegisters thatname on npm orPyPIYOURun npm installor pip installTHEIR CODEInstall scriptruns on yourmachineAISuggests a package that doesn't existATTACKERRegisters that name on npm or PyPIYOURun npm install or pip installTHEIR CODEInstall script runs on your machine

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

TyposquattingSlopsquatting
Who makes the mistakeA person typing a nameAn AI suggesting a name
What the fake name looks likeOne letter off: reqeustsPlausible but invented: huggingface-cli
How attackers pick namesCommon typos of popular packagesNames models suggest again and again

Signs of a made-up package

How to check a package before you install it

  1. Look it up

    Open the package on npmjs.com or pypi.org before installing. Check its age, author, weekly downloads and source repo.

  2. Pin and lock

    Pin versions and commit your lockfile, so a new release can't slip in.

  3. Ask for the source

    Ask your AI to name the official package and link its repo, then open that link yourself.

CHECK PROMPT
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

  1. Spracklen et al., USENIX Security 2025 (PDF)
  2. Lasso Security: AI package hallucinations
  3. 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 repo

Leakcade 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

Patch Notes by Leakcade

A short weekly email: what changed in AI coding tools, one real security mistake, one prompt you can reuse.