← Back to blog
·The mirago teamSecurityAI Coding

What Is Slopsquatting? The AI Supply-Chain Attack, Explained

Slopsquatting is a new supply-chain attack that weaponises the package names AI coding tools hallucinate. Here's how it works and how to defend against it.

Slopsquatting is a supply-chain attack that turns an AI model's mistakes into a delivery mechanism for malware. The name is a play on typosquatting — but instead of betting on your typos, attackers bet on the package names that AI coding tools confidently invent.

Where the "slop" comes from

When you ask an AI assistant for Python code, it sometimes writes an import for a package that doesn't exist. It made the name up — a hallucination. Researchers noticed two things that make this dangerous:

  1. Models don't invent random gibberish. They hallucinate plausible, repeatable names — the same fake name shows up across many prompts.
  2. That repeatability is predictable enough to attack.

So an attacker collects the fake names models love to suggest, registers them for real on PyPI, and fills them with malware. The "slop" the AI produces becomes the squat.

Why it's worse than a normal typo

With a typo, pip install usually fails — the misspelling doesn't exist, you notice, you move on. With a registered slopsquat, pip install succeeds. The code looks right, the import resolves, and you've now run someone else's payload.

```python
import fastjson_validator # looks fine. doesn't exist... until an attacker registers it.

def parse(payload):
return fastjson_validator.parse(payload)
```

How to defend against slopsquatting

The cheapest defence is to verify every imported package before you install it:

  • Check that each import actually exists on PyPI.
  • Be suspicious of packages that are brand-new and barely downloaded and not already a dependency of yours — a common slopsquat fingerprint.

That's exactly what mirago does. It reads your code, checks every import against PyPI, and flags the fakes:

```bash
pipx install mirago
mirago check .
```

See how mirago grades each package, and read up on the closely-related typosquatting vs slopsquatting distinction.

The takeaway: AI tools will keep inventing package names. Slopsquatting is what happens when attackers get there first — so check imports before you install them.