Typosquatting on Package Registries: What Researchers Have Found

Typosquatting is the trick of publishing a package whose name is one slip of the keyboard away from a popular one, then waiting for someone to install it by mistake. Security researchers and registry operators have studied the pattern for years. This page summarises the kind of evidence that exists and what it implies for anyone choosing or publishing a package name.

Where the evidence comes from

Three sources dominate. Academic security papers collect malicious packages removed from npm, PyPI and RubyGems and classify how they were named, how they ran code and what they stole. Security vendors publish write-ups each time they detect a campaign, often describing dozens or hundreds of look-alike names uploaded in a short burst. Registry operators publish policy changes and incident notes after removing packages. Each source has a bias: vendors report what their scanners catch, and academic datasets only contain packages someone already flagged.

Recurring patterns

The naming techniques show up again and again:

TechniqueIllustrative example
Character omission or doublingreqests for requests
Swapped or adjacent keyslodsah for lodash
Separator gamespython-dateutil vs python_dateutil vs dateutil
Scope confusionan unscoped name copying a scoped package
Combosquattinga real name plus "-js", "-utils" or "-dev"
Dependency confusiona public package with the same name as a company's private one

The payloads usually run during installation, through npm lifecycle scripts or a Python setup.py executed at build time, which is why so many reports focus on install hooks rather than on the library code itself.

How registries have responded

Registries have tightened rules over time rather than in one step. npm blocks new names that differ from an existing package only by punctuation, so you cannot register a dotted or dashed twin of a well-known name. PyPI normalises names, treating case, hyphens, underscores and dots as equivalent, as described in the Python Packaging User Guide. PyPI's name-retention process is set out in PEP 541. Go sidesteps much of the problem because a module path is a repository URL, although look-alike domains and repository names remain possible. Scanning of new uploads and faster takedowns are now common across major registries, but research consistently notes that detection happens after publication, so some installs still occur.

What it means for you

If you publish:

If you consume:

Our walkthrough on typosquatted names covers the naming side in more depth, and the naming conventions essay explains how to pick a name that is hard to imitate.