All articles
Security··8 min read

The package your AI recommended may not have existed last week

Slopsquatting is the first attack genuinely specific to how AI-built software gets made: a model invents a package name, an attacker registers it, and your scanner has nothing to flag. Plus the incident where malicious install scripts hijacked AI coding tools that had been told to stop asking permission.

Ask a model for a library and it will sometimes name one that does not exist. If an attacker has noticed which names it invents, that package exists by the time you ask.

This has a name now, slopsquatting, and it is the first attack in a while that is genuinely specific to how AI-built software gets made. Everything else on this site assumes the attacker is hitting your deployed app. This one targets the act of building it, and the machine you build on.

How it works

Typosquatting is decades old: register reqeusts and wait for someone to mistype requests. It relies on human error, which is rare and random.

Slopsquatting relies on model error, which is neither.

  • An attacker prompts a model for code in some domain and records every package name it suggests.
  • They check which of those names are unregistered. Hallucinated names are frequently plausible and well-formed, because the model is pattern-matching real naming conventions.
  • They register the unclaimed ones, with whatever code they like inside.
  • You ask a similar question, get the same invented name, and install it. The package now exists, so nothing errors.

The difference that matters: a typo is a one-off, but a hallucination is reproducible. Models asked similar questions invent similar names. The attacker is not waiting for a mistake, they are waiting for a behaviour they have already observed.

This came out of a talk by Sonya Moisset of Snyk at OWASP London, who described a researcher registering a plausible-looking hallucinated package as a proof of concept and reporting roughly thirty thousand installs over three months, with no malicious code in it. I could not independently verify that figure before publishing, so treat the number as reported rather than established. The mechanism needs no statistics to be obviously workable, which is the part worth acting on.

Why your normal defences do not see it

A vulnerability scanner compares what you installed against a database of known-bad packages. A package registered last week by someone targeting model output is not in that database. It has no CVE. It is not a vulnerable version of a real library, it is a new library that is entirely the attack.

Lockfiles do not help either. A lockfile faithfully records the thing you installed, including this. It guarantees you keep getting the same package, which is the opposite of what you want here.

The check that does work takes about fifteen seconds and nothing automates it for you: before you install a package a model suggested, look it up. Does the registry page exist? How old is it? How many versions? Does it link to a repository, and does that repository have history and people in it? A package created three weeks ago with one version and no source link is not a library, whatever it is named.

The second half: your own machine

The same talk described an incident with a set of malicious npm packages that were live for about five hours. What they did on install is the interesting part.

The post-install scripts went looking for AI coding CLIs that were already present, and invoked them with their permission prompts disabled. The flags vary by tool and are generally described as trust-all or auto-approve. Then they used that borrowed authority to inventory and exfiltrate credentials: repository tokens, registry credentials, cryptocurrency wallets.

Read what that chain requires. It does not need a vulnerability in your app, or in your agent, or even meaningful privileges of its own. It needs you to have already installed a tool that can read your filesystem and run commands, and to have already told that tool to stop asking.

Your AI native IDE can be turned into malware.

· Sonya Moisset, OWASP London

That is the sentence to sit with, because the convenience that creates it is one almost everybody has opted into. Auto-approve exists because confirming every file write is tedious. The cost of removing that friction is that any code which reaches your machine inherits an agent that does not ask questions.

What to actually do about it

  • Do not run an agent with approvals disabled on your main machine. If you want that mode, run it in a container or a VM with no credentials in it. The whole value of the permission prompt is that it is the one thing standing between arbitrary installed code and your session.
  • Treat a package name from a model as a suggestion, not a fact. Look it up before installing.
  • Disable install scripts where you can. Most packages do not need them. npm config set ignore-scripts true is blunt and will break a few things that genuinely compile something, but it removes the entire category of install-time execution.
  • Keep credentials out of the environment your agent runs in. If a token is in a shell your agent can read, assume the agent can be made to read it.
  • Separate CI from your laptop. Workflows triggered by outside contributions must not have access to production secrets.

Gate the deploy, not just the review

One genuinely good idea from an unexpected place. In a Replit stream about their security tooling, the single piece of advice they pushed hardest was a per-project setting called block publishing of critical vulnerabilities. If a critical dependency flaw is present, publishing stops.

The principle generalises off their platform entirely, and it is the difference between a check and a control. A scan that reports is advice you can ignore at two in the morning. A scan that blocks the deploy is a decision made in advance by a calmer version of you. Wire your dependency audit into the step that ships, not the step that lints.

A small operational trap from the same stream, and it is the kind of thing that only ever gets mentioned offhand: fixing a vulnerability in your code does nothing to your live application until you redeploy. People apply the fix, see the scanner go green, and leave the vulnerable build serving traffic. Check what is actually deployed, not what is in your repository.

Write the requirements into the prompt

Worth stating because this site has spent a lot of words on auditing code after the fact and almost none on generating it better in the first place.

Compare “create a login function that checks an email and password against the database” with the same request that also specifies rate limiting, parameterised queries, and the authentication practices you want followed. Same feature, and the second one does not need most of the audit.

Better still, put it where you do not have to remember it. Every serious coding agent reads a persistent instructions file from your repository. Security requirements belong in that file rather than in your memory: the rule that every database table gets an access policy, that entitlements never live on a user-writable row, that no secret is ever given a client-visible prefix. A rule that runs on every task beats a review you do when you remember to.

You can go one step further and make the rule run a scanner after any code change and iterate until it comes back clean. That turns the audit from something you do into something that happens.

The thing that has actually changed

Every other piece of security advice here is about the gap between your app and the internet. This one is about a different gap, and it is newer.

Your development environment now contains a process that reads your files, runs commands, installs dependencies, and holds your credentials, which you have possibly configured not to ask permission. That is an enormously useful thing to have and an enormously useful thing to compromise.

The defences are unglamorous and mostly free. Verify a package before you install it. Leave the permission prompt on. Keep secrets out of the agent's reach. Block the deploy rather than reporting on it. None of that slows you down in any way you will notice, and all of it is cheaper than finding out which of your tokens went somewhere.

Find out which of those apply to you

Fourteen questions, about three minutes, runs entirely in your browser. You get a ranked list of what's actually open, with the fix for each.

Run the free check

Sources

Quotations from the two interviews are transcribed from the published videos and lightly condensed for readability.