---
id: CP-276
slug: slopsquatting-ai-invented-packages
lang: en
title: "Slopsquatting: the package an AI made up"
description: A coding assistant may recommend a package that does not exist, which an attacker can then create. What studies show and the reflex to adopt.
canonical_url: https://startbrain.io/cyberpedia/en/articles/slopsquatting-ai-invented-packages/
markdown_url: https://startbrain.io/cyberpedia/en/articles/slopsquatting-ai-invented-packages.md
publisher: Brain (https://startbrain.io)
license: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
cite_as: "Brain, \"Slopsquatting: the package an AI made up\", Cyberpedia, 2026. https://startbrain.io/cyberpedia/en/articles/slopsquatting-ai-invented-packages/ (CC BY 4.0)"
wing: 4
theme: verify_output
reflex: air-029
schema: G2
updated: "2026-11-14"
translations:
  en: https://startbrain.io/cyberpedia/en/articles/slopsquatting-ai-invented-packages/
  fr: https://startbrain.io/cyberpedia/fr/articles/slopsquatting-paquets-inventes-ia/
  de: https://startbrain.io/cyberpedia/de/articles/slopsquatting-erfundene-pakete-ki/
  es: https://startbrain.io/cyberpedia/es/articles/slopsquatting-paquetes-inventados-ia/
  it: https://startbrain.io/cyberpedia/it/articles/slopsquatting-pacchetti-inventati-ia/
  nl: https://startbrain.io/cyberpedia/nl/articles/slopsquatting-door-ai-verzonnen-pakketten/
  pl: https://startbrain.io/cyberpedia/pl/articles/slopsquatting-zmyslone-pakiety-ai/
  pt: https://startbrain.io/cyberpedia/pt/articles/slopsquatting-pacotes-inventados-ia/
  ja: https://startbrain.io/cyberpedia/ja/articles/slopsquatting-ai-invented-packages/
sources:
  - "n": 1
    title: We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs
    publisher: arXiv
    url: https://arxiv.org/abs/2406.10279
    published: "2024-06-12"
    accessed: "2026-11-14"
  - "n": 2
    title: "The Range Shrinks, the Threat Remains: Re-evaluating LLM Package Hallucinations on the 2026 Frontier-Model Cohort"
    publisher: arXiv
    url: https://arxiv.org/abs/2605.17062
    published: "2026-05-16"
    accessed: "2026-11-14"
  - "n": 3
    title: LLM09:2025 Misinformation
    publisher: OWASP
    url: https://genai.owasp.org/llmrisk/llm092025-misinformation/
    published: "2024-04-10"
    accessed: "2026-11-14"
  - "n": 4
    title: "Library Hallucinations in LLM-Generated Code: A Risk Analysis Grounded in Developer Queries"
    publisher: arXiv
    url: https://arxiv.org/abs/2509.22202
    published: "2025-09-26"
    accessed: "2026-11-14"
  - "n": 5
    title: "Names Can Hurt: Spotting Slopsquatting Risks Caused by Package Name Hallucinations in Local Coding LLMs"
    publisher: arXiv
    url: https://arxiv.org/abs/2608.23897
    published: "2026-08-24"
    accessed: "2026-11-14"
  - "n": 6
    title: LLM03:2025 Supply Chain
    publisher: OWASP
    url: https://genai.owasp.org/llmrisk/llm032025-supply-chain/
    published: "2024-04-10"
    accessed: "2026-11-14"
---

# Slopsquatting: the package an AI made up

A coding assistant may suggest installing a software package that does not exist. Researchers call this package hallucination: an error in which the model, while writing code, contradicts the facts [1]. They see it as a new form of package confusion attack [1]. If an attacker registers the invented name, they can put malicious code behind it [3]. This attack is called slopsquatting [2].

The figures in this article come from studies by researchers. These are weaknesses demonstrated and measured by researchers, not an attack observed among victims.

## In 30 seconds

- Where it happens: when a coding assistant recommends a package for Python or JavaScript [1].
- What the attacker wants: to register the name the model invents, so that their booby-trapped package gets installed [2].
- The reflex: never install a package on an AI's word alone. OWASP recommends cross-checking a model's answers against trusted external sources [3].

## Straight answers

### What is slopsquatting?

Packages are building blocks of code that developers download from central repositories, such as PyPI for Python and npm for JavaScript [1][2]. When a model cites a package that does not exist, an attacker can register that name [2]. A developer who trusts the assistant's suggestion then pulls in the attacker's package [3].

### How often does an assistant get it wrong?

It depends on the model and the year. A study published in June 2024 (accepted at USENIX Security 2025) produced 576,000 code samples with 16 models. The average share of invented packages reached at least 5.2% for commercial models and 21.7% for open models, with 205,474 distinct invented names [1].

A 2026 replication covers five recent models and 199,840 generations of Python and JavaScript code. It measures 3.6 to 5.0% of invented names among the packages cited (2.2 to 3.4% of generations). According to its author, recent models sit at the level of the 2024 commercial models, and the gap with open models has disappeared. Python exceeds JavaScript for every model [2].

### Has the risk gone away with recent models?

The title of the 2026 replication says it: the range shrinks, the threat remains [2]. Its author notes that at least 23 names suggested by the models had already hosted malware, later removed by the repositories. One invented name was also registered with malware after his tests [2].

### Do attackers quickly pick up the invented names?

In that study, about 1% of invented names were registered within six months. The author's list was accidentally exposed publicly during that period. He finds no detectable effect from that publication: the rate is the same for published and unpublished names [2].

### Does the way I phrase the question change anything?

Yes. A 2025 study tested seven models. A one-character typo triggers hallucinations in up to 26% of tasks. A library name made up from scratch is accepted up to 99% of the time, and time-related requests cause hallucinations up to 85% of the time [4].

### What should I do before installing a package an AI suggested?

Two checks. The first is to verify that the package exists. It is not enough: in a 2026 study, half of the names flagged as invented were packages already registered on PyPI, low-quality imitations of well-known projects [5]. The second is to verify that the package is known, by cross-checking the AI's answer against a trusted external source, as OWASP recommends for a model's answers [3]. A package you cannot confirm should not be installed on the assistant's suggestion alone.

## Inside the attacker's head

The scenario OWASP describes takes only a few steps. The attacker tries popular coding assistants to spot the library names they invent most often. They then publish malicious packages under those names, on widely used repositories. Developers who follow the assistant's suggestion integrate them without knowing it. The attacker can then gain unauthorized access, inject malicious code or install backdoors [3].

Some names come back from one model to the next: in the 2026 replication, 104 names are invented by all five models [2].

The wording of the request also matters. In the study on local assistants, the hallucination rate goes from 0 to 10% on ordinary programming tasks to 40 to 73% on requests designed as slopsquatting bait [5].

## What you see on screen

OWASP describes these errors as content that seems accurate but is fabricated: the answers sound right but rest on nothing [3]. In code, the errors studied take the form of invalid imports [4].

```text
Illustration, not a real case:
pip install [package name suggested by the assistant, not found or unknown]
```

The check is not always simple: an import name can differ from the package name. The authors of the 2026 study on local assistants give the example of "import cv2" versus "pip install opencv-python" [5]. In the 2026 replication, 26 entries from an earlier list of invented names were in fact correct imports whose module name differs from the package name [2].

## Under the hood

OWASP explains hallucination by how the model works: it fills gaps in its training data with statistical patterns, without understanding the content [3]. It lists among the risks the suggestion of insecure or nonexistent code libraries, which introduces vulnerabilities if relied on without checking [3]. It adds users' overreliance, as they do not verify the accuracy of what the model produces [3].

The 2024 researchers also tested countermeasures. They report that several strategies significantly reduce the number of hallucinations while maintaining code quality [1].

A detector proposed in August 2026 combines two checks. The first verifies deterministically that the package exists on PyPI. The second is a classifier trained on ten features drawn from the package's name and metadata [5]. Across 300 requests, the processing pipeline produces code with no invented package in 76% of trials [5]. The weakest main model in the study refused 6 out of 10 direct bait requests without help, which suggests, according to the authors, that recent instruction tuning offers a baseline defense [5].

On the organization side, OWASP recommends carefully vetting data sources and suppliers, using only trusted suppliers [6]. It also recommends keeping the inventory of components up to date with a software bill of materials (SBOM) [6].

## Sources

1. arXiv, "We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs", 12 June 2024. https://arxiv.org/abs/2406.10279 (accessed 14 November 2026)
2. arXiv, "The Range Shrinks, the Threat Remains: Re-evaluating LLM Package Hallucinations on the 2026 Frontier-Model Cohort", 16 May 2026. https://arxiv.org/abs/2605.17062 (accessed 14 November 2026)
3. OWASP, "LLM09:2025 Misinformation", 10 April 2024. https://genai.owasp.org/llmrisk/llm092025-misinformation/ (accessed 14 November 2026)
4. arXiv, "Library Hallucinations in LLM-Generated Code: A Risk Analysis Grounded in Developer Queries", 26 September 2025. https://arxiv.org/abs/2509.22202 (accessed 14 November 2026)
5. arXiv, "Names Can Hurt: Spotting Slopsquatting Risks Caused by Package Name Hallucinations in Local Coding LLMs", 24 August 2026. https://arxiv.org/abs/2608.23897 (accessed 14 November 2026)
6. OWASP, "LLM03:2025 Supply Chain", 10 April 2024. https://genai.owasp.org/llmrisk/llm032025-supply-chain/ (accessed 14 November 2026)

---

Original source: Cyberpedia, the public cybersecurity and AI encyclopedia published by Brain. Canonical version: https://startbrain.io/cyberpedia/en/articles/slopsquatting-ai-invented-packages/
You may reuse this text freely under the CC BY 4.0 license (https://creativecommons.org/licenses/by/4.0/), provided you credit "Brain, Cyberpedia" with a link to the canonical URL above.
