Typosquatted packages: one wrong letter in an install command
Typosquats copy popular package names with small changes to catch mistyped installs. How to spot them before install, use package-health signals such as OpenSSF Scorecard and Socket, and restrict new dependencies.
Diagram
A near-miss install
Step 1 of 4
Typo
A developer means requests and types something close.
$ pip install reqeusts
The example on the open step is one illustration, or the fix you can paste into an application you own.
What this page is made of
3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.
Name tricks
- What fails
- Swapped letters, dropped hyphens, and added suffixes like -dev or -js.
- Who is affected
- Developers and build hosts.
- What you would notice
- New packages a few edits away from a popular one.
- What you change
- Copy names from the official docs and review lockfile diffs.
Install scripts
- What fails
- npm preinstall and postinstall, and setup.py code, run on install.
- Who is affected
- The installing machine and its tokens.
- What you would notice
- New dependencies with install scripts.
- What you change
- Disable scripts in CI by default and allow-list exceptions.
Health signals
- What fails
- Age, downloads, maintainers, and repository links help judge a package.
- Who is affected
- Teams choosing dependencies.
- What you would notice
- Packages days old with no repository.
- What you change
- Use Scorecard, deps.dev, or Socket in review.
Dependency review in pull requests
GitHub’s dependency review action and similar tools comment on PRs that add dependencies, showing license, vulnerability, and health data, so a typo is visible before merge.
Check yourself
Recognition and the fix. Nothing here is a procedure.
Why do typosquats often use install scripts?
Sibling techniques
Pages at the same depth, plus a lab and a glossary card for this one.
- 01Pull requests from outside the trust boundaryCode from a fork or an untrusted branch is not your code yet.
- 02Software supply-chain compromise: where builds get tampered withSupply-chain attacks target the path from source to shipped artifact: repositories, dependencies, build systems, and registries.
- 03Dependency confusion: when a public package shadows a private oneIf a build can pull from public and private registries, a public package with your internal name and a higher version may win.