Developer and Text Tools

Typosquatting on npm and PyPI: How to Check Your Dependency Names

How typosquatted packages on npm and PyPI trick developers, which naming tricks to watch for, and a quick routine to check names before installing.

Saizul Amin
Saizul Amin3 Nov 2026 · 3 min read
Typosquatting on npm and PyPI: How to Check Your Dependency Names

Typosquatting on npm and PyPI: How to Check Your Dependency Names

Public package registries let anyone publish under any free name. Attackers use that freedom in a simple way: they register names that are one slip away from popular packages and fill them with code that runs during installation, steals tokens or environment variables, and often still installs the real package so nothing looks wrong. Security firms and the registries themselves remove such packages every week. The defence starts with something unglamorous: checking names.

How typosquatting works

Developers type install commands from memory, copy them from blog posts and accept suggestions from AI assistants. Every one of those paths can produce a wrong name. If the wrong name exists on the registry, the install succeeds silently. Attackers therefore publish packages that match likely mistakes for the most downloaded packages, and some of those packages collect thousands of installs before anyone notices.

A well-known early case was a set of npm packages in 2017 that included crossenv, a lookalike of the popular cross-env, which sent environment variables to a remote server. Since then the pattern has repeated on npm, PyPI, RubyGems and other registries many times.

The naming tricks

  • One character off. expres for express, urlib3 for urllib3.
  • Swapped letters. lodahs for lodash, reqeusts for requests. Fast typists make this mistake constantly.
  • Visual lookalikes. rn looks like m in many fonts, so rnoment can pass for moment. Zero and the letter o, one and lowercase l, are other favourites.
  • Separators. cross-env versus crossenv on npm. On PyPI hyphens, underscores and dots are treated as the same name, so this trick matters less there.
  • Extra words. Adding js, node, py, python, cli or official to a real name, such as node-fetch-js.
  • Scope tricks on npm. A lookalike scope like @angu1ar/core, or a popular unscoped name republished under an unknown scope.

A quick routine

  1. Before adding a dependency, copy its name from the official documentation or repository, not from memory or a forum post.
  2. Check the registry page: publisher, linked repository, weekly downloads, first publish date and number of versions. A brand-new package with a famous-sounding name and no repository is a red flag.
  3. Review new names in pull requests, not just version bumps.
  4. Periodically check your whole manifest for near misses.
  5. Use lockfiles and install with the lockfile in CI, so a typo cannot enter quietly through a fresh resolve.

Checking a whole manifest

The Package Typosquatting Checker automates step four. Paste package.json, a lockfile, requirements.txt or a simple list, and it compares each name with about 300 widely used npm and PyPI packages. It looks for one-character edits, swapped letters, visual lookalikes, separator and affix variants, and npm scope tricks, and gives each name a risk score with the technique and the popular package it resembles. A threshold slider controls how much you see, and a trusted-names box silences packages you have already verified. Nothing is sent to the registries; the comparison runs in your browser.

Expect some false positives

Plenty of honest packages have names close to famous ones: preact and react, lodash-es and lodash, flask-cors and flask. A flag is a prompt to look, not a verdict. After checking, add the name to your trusted list and move on.

Beyond names

Name checks catch the most common trick, but supply-chain defence has more layers. Prefer packages with provenance or signed releases, pin versions with lockfiles, restrict install scripts in CI where you can, watch for unexpected new dependencies in reviews, and use tools that analyse package behaviour. And when something looks wrong, report it to the registry: removal protects everyone else.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages