Deutsch
Security wikiDependencies

What is typosquatting in package registries?

Also known as: typo-squatting, package name squatting, slopsquatting, look-alike packages

Typosquatting means publishing a malicious package under a name close to a popular one. Why AI-built apps are exposed and how to check your dependencies.

By Tim GeithnerPublished 2 min read

Short answer

Typosquatting is an attack where someone publishes a malicious package under a name that looks like a popular one, hoping developers install it by mistake. A related risk, sometimes called slopsquatting, is an AI assistant suggesting a package name that doesn’t exist, which an attacker then registers. Check every new dependency’s exact name, author and history before you install it.

Ask an AI about this page:ChatGPTClaude

On this page

Typosquatting is an attack where someone publishes a malicious package under a name that is easy to confuse with a popular one, so that developers install it by mistake. The OWASP npm cheat sheet defines it as “an attack that relies on mistakes made by users, such as typos”, and MITRE ATT&CK lists it among the ways attackers compromise software dependencies. It is one form of software supply chain attack.

Look-alike names come in a few shapes: a swapped or missing letter, a hyphen added or removed, a plural, or a plausible extra word such as -js or -utils on a well-known name. The OWASP cheat sheet cites real npm cases, for example a fake package posing as cross-env.

Typosquatting in an AI-built app

In a vibe-coded project, you often don’t type package names at all. The AI tool decides that it needs a date library or a PDF generator and adds it to package.json. That shifts the risk:

  • The AI misremembers a name. A coding model can produce a name that is close to the real one, or invent one that sounds right. The OWASP cheat sheet calls the second case slopsquatting: attackers register names that AI tools are known to suggest.
  • Nobody reviews the diff. A new line in package.json is easy to miss among dozens of changed files.
  • Install scripts run immediately. npm packages can run a postinstall script on install, so a malicious package can act before you ever import it.

How to check your app

  • Open package.json and read every dependency name slowly. For each one you don’t recognise, look it up on npmjs.com: does the name match the project’s official docs, is the repository link real, how long has it existed, how many weekly downloads does it have?
  • Compare with your git history: which dependencies were added recently, and by which change?
  • Watch out for packages with very few downloads and a very recent first release that sit next to a famous package with an almost identical name.

How to fix or prevent it

  • Install packages by copying the exact name from the library’s official documentation, not from memory or from an AI answer.
  • Ask your AI tool to list every package it adds and why, and check each one before accepting the change.
  • Commit your lockfile and install with npm ci, so a name that slipped in once can’t quietly change later.
  • Consider turning off install scripts (npm install --ignore-scripts, or ignore-scripts=true in .npmrc) and allowing them only for packages that need them, as the OWASP cheat sheet suggests.
  • If a bad package was installed, remove it and rotate any secrets the install could reach; see Secrets in git history for how to rotate.

Frequently asked questions

What is slopsquatting?

A variant of typosquatting for the AI era: a coding assistant suggests a package name that doesn’t exist, and an attacker registers that name with malicious code. The OWASP npm security cheat sheet mentions this risk alongside classic typosquatting.

Does npm audit catch typosquatted packages?

Only once the package has been reported and an advisory exists. A new look-alike package can be installed before anyone notices, so checking names before installing matters more.

What should I do if I installed a suspicious package?

Remove it, reinstall from a clean lockfile, and assume that anything the install could reach is exposed: rotate tokens and secrets that were on that machine or in that CI run.

Sources

  1. 1.NPM Security best practices — OWASP Cheat Sheet Series
  2. 2.Supply Chain Compromise: Compromise Software Dependencies and Development Tools (T1195.001) — MITRE ATT&CK
  3. 3.A03:2025 Software Supply Chain Failures — OWASP Top 10

Find this in your own app

ShipRely reads your repository (read-only), proves each finding with file and line, and gives you a fix prompt to paste into your AI builder.

Run a demo audit
  • Read-only access to your repository
  • Every finding with file and line
  • Fix prompts for Lovable, Cursor, Claude Code and Bolt