Cookies Notice
This site uses cookies to deliver services and to analyze traffic.
📣 Apiiro named a Leader in the 2026 Gartner® Magic Quadrant™ for Software Supply Chain Security
Typosquatting is a supply chain attack where a malicious actor publishes a software package with a name deliberately similar to a popular, legitimate package. When a developer misspells a package name during installation, they pull the attacker’s package instead, which can execute arbitrary code, steal credentials, or establish a backdoor. The attack exploits human error and the trust developers place in public package registries.
Typosquatting supply chain attacks have become one of the most accessible and effective ways to compromise software at scale. Because registries like npm, PyPI, and RubyGems allow anyone to publish packages under almost any name, attackers can register thousands of near-miss variations and wait for installations. This makes typosquatting a persistent threat to software supply chain security across every language ecosystem.
A typosquatting attack follows a predictable pattern. The attacker identifies a popular package, generates name variants that a developer might type by mistake, and publishes malicious packages under those names.
Common naming tricks include character transposition (expresss instead of express), dropped or added characters (colurs instead of colors), hyphen or underscore variations (python-dateutil vs. python_dateutil), and namespace squatting where the attacker registers a scope or organization name that looks official. Once published, the malicious package sits on the registry and waits. When a developer runs an install command with a typo, the package manager fetches the attacker’s version without warning.
The malicious payload typically executes in the install script, which runs automatically during installation. Within seconds, the code can exfiltrate environment variables, SSH keys, cloud credentials, or inject a persistent backdoor into the developer’s system or CI/CD pipeline. Unlike dependency confusion, which exploits namespace resolution between public and private registries, typosquatting relies purely on human error in typing the package name.
The volume and sophistication of npm typosquatting campaigns have grown sharply. Attackers routinely publish dozens of near-miss variants of popular npm packages, embedding credential harvesters or crypto miners in install hooks.
PyPI has seen similar campaigns. Researchers have repeatedly identified clusters of malicious packages mimicking names like requests, urllib3, and beautifulsoup4. Some of these packages survived on the registry for weeks before detection, accumulating thousands of downloads. The RubyGems, Cargo, and NuGet ecosystems face the same risk, though npm and PyPI are the most frequently targeted because of their size and the volume of installs they handle.
A single successful typosquatting install can compromise an entire build pipeline, since CI/CD environments typically install dependencies with elevated permissions. Packages identified in these campaigns are classified as malicious dependencies, but many are not flagged by traditional vulnerability databases because they are not exploiting a CVE; they are purpose-built attack tools.
Package typosquatting succeeds because the conditions that make it work are built into normal development workflows.
Developers install packages by typing names from memory or copying them from tutorials, Stack Overflow answers, or chat messages. A single wrong character installs the wrong package, and most package managers do not warn about near-miss names. Auto-completion helps in some environments but does not exist in CI/CD scripts, Dockerfiles, or requirements files where dependencies are listed as plain text.
The speed of development compounds the risk. When a developer is installing ten packages while scaffolding a project, each install command is a low-attention action. Reviewers scanning a pull request that adds a new dependency may not catch a subtle name difference, especially in a lockfile with hundreds of entries. The cognitive cost of verifying every package name is high enough that it rarely happens consistently, which is exactly what typosquatting exploits.
Dependency typosquatting is difficult to prevent entirely because it exploits human error, but layered controls significantly reduce the risk.
Running software composition analysis as part of the CI/CD pipeline catches known malicious packages that have been reported and cataloged. Reputation-based checks that flag recently published packages with low download counts and high name similarity to popular libraries add another detection layer.
Typosquatting relies on a developer mistyping a package name. Dependency confusion exploits how package managers resolve between public and private registries with the same name. Both deliver malicious code, but through different mechanisms.
npm and PyPI are the most frequently targeted because of their size, open publishing model, and the volume of automated installs they handle. RubyGems, Cargo, and NuGet face the same risk at lower volume.
Yes. SCA tools detect known vulnerabilities by matching against advisory databases. A typosquatted package is purpose-built malware, not a known CVE, so it may not appear in vulnerability feeds until it has been reported and cataloged.
Removal depends on detection and reporting. Some are taken down within hours, but others survive for days or weeks, accumulating thousands of downloads before a researcher or automated system flags them.
Remove the package immediately, rotate any credentials or tokens that were accessible during installation, audit the environment for backdoors or unauthorized changes, and report the package to the registry for takedown.
Recognized by leading analysts
Apiiro is named a leader in ASPM by IDC, Gartner, and Frost & Sullivan. See what sets us apart in action.