Typosquatting: lookalike package names and how to spot them
Typosquatting is registering a name that looks like a real one and waiting for a slip. It is a form of cybersquatting that relies on typos people make when they enter a website address. On npm and PyPI the same idea targets package names, and on npm 11 a wrong name can bring in a package whose install scripts run by default. Compare the name with the project's own instructions, look at the package with npm view before you install, and let new versions age a few days.
Typosquatting on package registries is the same trick as on websites, moved to a place where the victim is a developer. A domain version waits for a mistyped address. A package version waits for a mistyped, half-remembered or copied name. The registry accepts it like any other name.
01What typosquatting means
The word describes a form of cybersquatting, which is registering or using a domain name in bad faith to profit from someone else's trademark. Typosquatting is the kind that relies on mistakes such as typos made when entering an address.
The difference from cybersquatting in general is the mechanism. A cybersquatter profits from a name close to someone else's brand. A typosquatter also depends on someone making a small error.
02Typosquatting on npm and PyPI
npm is the public registry for JavaScript packages. PyPI is the one for Python. Both let people publish under a name that is not taken, and a lookalike is a name like any other.
The attack works in three moves. The attacker publishes a package under a name close to a popular one. Some give it the behaviour of the real one, or part of it, so nothing breaks. You install it by mistake. Packages can also run scripts at install time: npm 11 runs preinstall, install and postinstall by default after placing the modules, while npm 12 blocks install scripts of dependencies unless you approve them.
The same pattern shows up outside the registries. Developers install by name in editors too, and the next section includes a case from an extension registry.
03Real cases of fake packages
| Case | Where | What it posed as | What it did |
|---|---|---|---|
| nodejs-smtp (Aug 2025) | npm | nodemailer, a mail package | Rewrote the packed app file (app.asar) of Atomic Wallet on Windows to swap recipient addresses |
| Fake Solidity extension | Open VSX, the extension registry Cursor uses | A legitimate Solidity extension | Downloaded and ran malicious code; one developer lost about $500,000 |
| Fake developer tools (Apr 2025) | npm and PyPI | Developer tools | Stole seed phrases and private keys |
Three details from these cases matter for spotting.
The mail package still sent mail, so tests passed and developers had little reason to doubt it. A working package is not proof of a clean package.
The fake Solidity extension had 54,000 downloads, a figure that was likely inflated. It implemented none of the features it claimed. In the search results it ranked 4th for "solidity", while the real one ranked 8th. Rank and download count did not separate the fake from the real one.
One npm package in the developer-tool group sent wallet keys through a Google Analytics endpoint disguised as telemetry. Network traffic can look ordinary too.
04How to spot a lookalike before you install
Do these in order. Each takes seconds.
- Copy the name from the project, not from memory. Use the install line in the project's README or website. A name you typed from memory is the one that goes wrong.
- Read the name slowly. Look for a doubled letter, a missing letter, a hyphen where there is none, or an extra word.
- Look at the owner. On npm, a scope is the part of a package name between the
@and the slash, and every user or organization is given a scope that matches its name. A scope lets two owners use the same package name without conflict. If the package should come from a company, check that the scope is the company's. - Run
npm viewon it. It shows data about the package and prints it to the terminal. To see only what the package pulls in, add the field name:npm view <name> dependencies. If a small helper depends on something unrelated to its job, ask why. - Do not take the newest version at once. Set the npm option
min-release-age, and npm installs only versions that were available for more than that many days. - Check for scripts. If you do not need install scripts,
ignore-scriptsset to true stops npm from running scripts specified inpackage.json.
More checks, such as signatures and audit, are in check an npm package for malware.
05When an agent chooses the name
When you type a package name, you notice it. When an agent adds one, you may not. Check the name the same way before you accept the install. How to keep agent installs behind a question is on slopsquatting.
There is a related risk where the attacker does not wait for your typo. They wait for an AI model to invent a name. That case has its own page. A third case, where a public package replaces a private one, is on dependency confusion.
06What typosquatting leads to
The cases above ended in stolen wallet keys and seed phrases, swapped payment addresses and a loss of about $500,000. A seed phrase or private key must never be shared with any code or bot.
If you think a lookalike ran on your Mac, start from npm malware. Other registries have their own pages: PyPI malware and malicious VS Code extensions.
07The short routine
Typosquatting depends on a moment of inattention, and the routine above removes it. Take the name from the project, read it, run npm view, and give new versions a few days. The wider picture of how packages get poisoned is on npm supply chain attack.
A lookalike package shows itself in what its install script starts; Artificial Immunity's free, open-source core watches program starts on your Mac and reports what it finds.
FAQ
What does typosquatting mean?
It is a form of cybersquatting that relies on mistakes such as typos that people make when they enter a website address into a browser. The same trick is used on package names.
What is the difference between typosquatting and cybersquatting?
Typosquatting is one form of cybersquatting. It depends on mistakes such as typos made when entering an address.
What is an example of typosquatting?
A package called nodejs-smtp impersonated nodemailer on npm and rewrote Atomic Wallet's app.asar file to swap recipient addresses. It is a lookalike by name and purpose, shown with other cases in the table above.
Is npm safe anymore?
npm is usable, but a package is not safe just because it is on npm. In September 2025, for example, malicious versions of several popular npm packages carried a post-install script that harvested data. Checking a package first is cheap, see the steps above.
What problems does typosquatting lead to?
Stolen wallet keys and seed phrases, swapped payment addresses, and in one case a loss of about $500,000 after a fake extension was installed.
How do I check a package name before installing?
Run npm view with the package name. It shows data about the package without installing it.
Related guides
Sources
- Wikipedia, typosquatting
- Socket, nodejs-smtp impersonating nodemailer
- Socket, npm and PyPI wallet stealers
- Kaspersky Securelist, fake Solidity extension in Cursor
- npm docs, about scopes
- npm docs, npm view
- npm docs, scripts
- npm docs, config
- PyPI blog, ultralytics attack analysis
- Claude Code docs, permissions
- Artificial Immunity