Join our Newsletter — 33% off our NHI Course
Home› Guides› Slopsquatting for Beginners: When AI Tools Suggest Code…
Guide Software & AI Supply Chain

Slopsquatting for Beginners: When AI Tools Suggest Code Packages That Do Not Exist

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 28 November 2026 11 min read
On this page

Slopsquatting is when attackers publish fake code packages under names that AI tools made up.

This guide is for students, new developers and anyone who asks an AI chatbot for help with code. You do not need to be an expert to be affected: if your team uses AI to write code, one made-up name can let a stranger's code onto your computers.

In short

  • AI coding tools sometimes suggest code packages that do not exist.
  • Attackers can publish a package under that made-up name, so the next person who follows the advice installs it.
  • Some made-up names come up again and again, which makes them easier to target.
  • Before you install a package an AI suggested, check that it is real, well used and the one you meant.

What you will learn

  • Explain slopsquatting in one sentence.
  • Spot the signs of a package name an AI may have made up.
  • Check a package before you install it.
  • Ask your team how AI suggestions are checked.
Ready-made code (package)
a bundle of code someone else wrote, which you add to your project instead of writing it yourself.
Online library of packages (registry)
a public website, such as npm or PyPI, where anyone can publish packages and anyone can download them.
Made-up answer (hallucination)
when an AI tool gives an answer that sounds right but is not true.

What is slopsquatting?

Imagine a travel guide that lists a café at an address where no café exists. A crook reads the guide, rents the empty shop and opens a fake café. Visitors trust the guide and walk straight in.

Slopsquatting works the same way. Many programs are built from packages, which are bundles of ready-made code. Developers download them from a public registry, an online library such as npm for JavaScript or PyPI for Python.

AI coding tools, such as chatbots and coding helpers, often suggest packages to use. Sometimes they suggest a name that does not exist. This is a kind of hallucination, an answer that sounds right but is false.[1]

Anyone can publish a new package under an unused name. So an attacker can take a made-up name, fill it with harmful code and wait. The word mixes "slop", a slang term for low-quality AI output, with "squatting", which means taking a name to exploit it. It was coined by Seth Larson of the Python Software Foundation.[2]

Where the comparison stops working: a fake café needs a building and staff. A fake package costs very little to publish, and one install can run its code on your computer.

Why does it matter?

A package you install can run code with the same access you have. On a developer's laptop or a build server, that can include passwords and keys for other systems.

The problem is common. One university study tested many AI models. Open models made up 21.7% of the packages they suggested. Commercial models did better, but still made some up.[1]

If you are learning to code with AI help

What could happen: you paste an install command from a chatbot and add a stranger's code to your project.

Check this: search the registry for the exact name before you install anything an AI suggested.

Next: Software Supply Chain Security for Beginners

If you lead a development team

What could happen: an AI helper adds a package nobody chose on purpose, and it reaches your build system.

Check this: make sure every new package is reviewed by a person before it is merged.

Next: AI-Generated Code Review Guide

If you pay someone to build your app

What could happen: your supplier uses AI to write code fast and does not check what it adds.

Check this: ask how they check new packages, including ones an AI tool suggested.

Next: Supply Chain Attacks for Beginners

What does it look like?

Here is a made-up chat between a student and an AI helper. The package name and site are invented.

Example only. All values are made up.

Student: How do I turn a spreadsheet into a chart in Python?

AI helper: Use the package "sheet-to-chart-EXAMPLE".     (1)
Install it with your package manager, then add:
  import sheet_to_chart_EXAMPLE                         (2)
This is a popular and well-tested choice.               (3)
  1. A name that sounds right. It may not exist, or it may exist only because someone registered it recently.
  2. The code looks normal, so nothing seems wrong.
  3. The AI sounds confident. Confidence is not proof that the package is real or safe.

Why this is risky: if the student installs the name without checking, they may get nothing. Or they may get a package an attacker published to catch this mistake.

The safer way: look the name up on the registry website first. Check how old the package is, who publishes it, how often it is downloaded and whether it links to a real project page. If anything looks off, ask the AI for a well-known option and check that too.

How does it work?

Here is how a made-up name can turn into a real risk.

  1. The suggestion. An AI tool recommends a package name that does not exist.
  2. The pattern. Some made-up names appear again and again when people ask the same kind of question. In one follow-up test, 43% of made-up names came back in all ten repeat runs.[2]
  3. The trap. An attacker who spots a repeated name publishes a package under it on a public registry.
  4. The install. A developer follows the AI's advice and installs the package. Some packages can run setup code as soon as they are installed.[4]
  5. The defence. Checking the name and reviewing new packages make the trap much harder to spring. A lockfile (a file that records the exact packages a project uses) also helps.
Diagram titled From a made-up name to a fake package. Step 1, an AI helper suggests a package name that does not exist. Step 2, the same made-up name comes up again for other people. Step 3, an attacker publishes a package under that name on a public registry. Step 4, a developer copies the install command and the package lands on a laptop or build server. A green bar underneath says break the chain before step 4: check the exact name on the registry, its age, publisher, downloads and project page.
Figure 1. How a name an AI made up can become a trap, and where a quick check breaks the chain.

Researchers have shown the risk is real. In 2024 a security researcher published an empty package under a name that AI tools kept inventing. He reported more than 30,000 downloads in three months, and found the name in install instructions in public projects.[3] His package was harmless, but an attacker's would not be.

A worked example

Talia Ilic is studying data science. She is building a small app to track her running times, and she asks an AI chatbot how to read data from her fitness watch.

The chatbot gives her a neat answer with a package name and a one-line install command. It says the package is "widely used". Talia is about to paste the command when she remembers the fake café.

She opens the registry website and searches for the exact name. Nothing comes up. The package does not exist.

She asks the chatbot again and gets a different name. This one does exist, but it was published four days ago. It has no project website, one version and a publisher with no other packages. That looks wrong, so she leaves it alone.

Talia messages her tutor, Otto Yeboah. He suggests she search the registry for well-known packages that read the same file format, rather than trusting a name from the chat. She finds one that is several years old, linked to a public project and updated often. She installs that one.

Otto shares her story with the class. He asks everyone to treat AI package suggestions as a starting point and to check each name before installing.

Myths and mistakes

What people thinkWhat is true
If the AI suggests a package, it must exist.AI tools sometimes invent package names that sound real.[1]
If the package exists on the registry, it is safe.Anyone can publish a package. A name that exists may have been registered by an attacker.
A made-up name is random, so nobody could guess it.Some made-up names repeat, which lets attackers predict them.[2]
This is the same as a typing slip.Typosquatting relies on a person mistyping a real name. Slopsquatting relies on an AI inventing a name.
Only beginners get caught.Researchers found a made-up name in install instructions in public projects.[3]

What can I do this week?

  • Look up the last package an AI suggested to you on the registry website and check its age and publisher.
  • Agree with your team that a person reviews every new package, whoever or whatever suggested it.
  • Make sure your projects keep a lockfile, so new packages show up as clear changes.
  • Ask suppliers who use AI tools how they check the packages those tools add.

Checklist

  • I check the exact name on the registry before installing a package an AI suggested.
  • I look at the package's age, publisher, downloads and project page.
  • I am wary of packages that are brand new, have one version or have no project page.
  • New packages are reviewed by a person before they are added to shared code.
  • Projects keep a lockfile saved with the code.
  • AI coding tools are not allowed to install packages without a person checking first.
  • Everyone knows who to tell if they think they installed a fake package.

Common questions

Is slopsquatting the same as typosquatting?

No. Typosquatting uses a name that looks like a real package, hoping someone mistypes it. Slopsquatting uses a name an AI tool invented, hoping someone trusts the AI. Both end the same way: a person installs a package an attacker published. See Malicious Package and Dependency Confusion Guide.

Is it safe to use packages suggested by ChatGPT or other AI tools?

It can be, if you check them first. Treat the suggestion as a lead, not an answer. Look the name up on the registry and check its age, publisher, downloads and project page. If you cannot confirm it is a real, well-used package, choose a different one.

Why do AI tools make up package names?

AI tools write text that is likely to sound right, based on patterns they learned. A name like "fast-csv-reader" sounds like a real package, so the tool may suggest it even if nobody ever published it. Researchers describe these made-up names as a lasting, built-in problem, not a rare glitch.[1]

What should I do if I installed a package I am now unsure about?

Tell your team or security contact straight away. Stop using the package and do not run the project again until someone has checked it. If it was on a computer holding passwords or keys, those may need to be changed. See the Malicious Open Source Package Response Playbook.

Can AI coding tools that install packages for me make this worse?

Yes, they can. If a tool installs packages by itself, there may be no moment where a person checks the name. We suggest setting such tools to ask before installing anything, and reviewing every new package before it reaches shared code.

Where next?

Ready for the detail? Read the practitioner guide: Slopsquatting and Package Hallucination Guide. It goes further into how attackers find repeated names, registry and install settings that reduce the risk, and how to detect a suspicious package.

Also useful:

Related NHI Mgmt Group resources: Malicious Package and Dependency Confusion Guide · Malicious Open Source Package Response Playbook · AI Supply Chain Security for Beginners

Key terms

Slopsquatting
Publishing a harmful package under a name that AI tools invented, so people who follow the AI install it.
Package hallucination
When an AI tool suggests a package name that does not exist.
Hallucination
An AI answer that sounds right but is wrong or made up.
Package registry
An online library that stores packages and hands them out to anyone who installs them.
Typosquatting
Giving a harmful package a name one small slip away from a real one.
Lockfile
A file that records the exact packages and versions a project installs.

Sources and further reading

  1. We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs. Spracklen et al., arXiv 2406.10279, 2024, revised March 2025 (USENIX Security 2025). https://arxiv.org/abs/2406.10279, accessed 28 Nov 2026.
  2. Slopsquatting: How AI Hallucinations Are Fueling a New Class of Supply Chain Attacks. Socket blog, Sarah Gooding, 8 April 2025 (vendor blog; reports the term's origin and the repeat-run results from the study above). https://socket.dev/blog/slopsquatting-how-ai-hallucinations-are-fueling-a-new-class-of-supply-chain-attacks, accessed 28 Nov 2026.
  3. Diving into AI Package Hallucinations. Lasso Security research blog, Bar Lanyado, 28 March 2024. https://www.lasso.security/blog/ai-package-hallucinations, accessed 28 Nov 2026.
  4. scripts. npm Docs (npm CLI v10), GitHub: lists the preinstall, install and postinstall steps that run when a package is installed. https://docs.npmjs.com/cli/v10/using-npm/scripts, accessed 28 Nov 2026.

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.