Slopsquatting Targets AI-Hallucinated Package Names; slopcheck Screens Dependencies

· Original article ↗

Summary

Attackers can register package names hallucinated by AI coding assistants and add malicious install hooks. A 2025 study found nearly 20% of sampled AI-generated code referenced nonexistent packages; the article describes slopcheck’s registry checks and CI controls.

Key points

  • Slopsquatting involves registering nonexistent package names suggested by AI coding assistants and adding malicious install hooks that may run when developers install them.
  • A 2025 USENIX Security study tested 16 code-generating models across 576,000 samples; nearly 20% referenced nonexistent packages, and 43% of hallucinated names recurred across runs.
  • The article says researcher Bar Lanyado registered huggingface-cli as a harmless test package on PyPI; it received 30,000 downloads in three months, and Alibaba copied the install command into a public repository README.
  • The article reports that react-codeshift spread through 237 repositories via AI-generated agent skill files, without deliberate planting.
  • slopcheck checks dependency names against registries, blocks nonexistent packages, and flags suspicious ones; its author says it supports seven ecosystems and can run in CI.
  • The tool’s own test on a 100-dependency project flagged two legitimate packages as suspicious, illustrating that flagged results may need review.
  • The article says no large-scale breach had been publicly pinned to slopsquatting as of 2026.

Article Details

Defense Focus
Prevent slopsquatting by verifying dependency names against their package registries before installation.
Detection Methods
  • Check whether each dependency exists in its ecosystem's live registry; block names that do not resolve.
  • Flag existing packages using signals including registration within the last seven days, fewer than 100 downloads, hallucination-pattern naming, or no source repository link.
  • Compare dependency names with popular packages using Levenshtein distance to identify likely near-miss typosquats.
  • Scan dependency manifests automatically and check dependencies in parallel.
Data Sources
  • Dependency manifests, including requirements.txt, pyproject.toml, package.json, Cargo.toml, go.mod, Gemfile, pom.xml, build.gradle, and composer.json.
  • Live package-registry data on package existence, registration age, download counts, and source repository links.
  • Popular package names in each ecosystem for similarity checks.
Rule Types
  • Machine-readable JSON scan output
Platforms
  • slopcheck CLI
  • GitHub Actions
Defensive Actions
  • Run slopcheck before installing AI-recommended dependencies.
  • Block nonexistent packages and review suspicious packages before installation; use safe install mode to prevent flagged packages from reaching pip or npm.
  • Use allowlists for internal packages that are absent from public registries.
  • Add the GitHub Action to scan pull requests that change dependency files and fail checks when slop is detected.
  • Use the --fix option to remove hallucinated dependencies from dependency files while retaining a comment in the diff.

MITRE ATT&CK

People

Products

Tools

Related Articles