Typosquatted Package
What is Typosquatted Package?
Typosquatted PackageA malicious open-source package published under a name that closely resembles a popular library so that developers install it by mistake.
Typosquatted packages target the ecosystem-level autocomplete habits of developers. The attacker picks a widely used library — react, lodash, requests, cross-env, urllib3 — and publishes a malicious package with a tiny variation in the name (crossenv vs cross-env, python3-dateutil vs python-dateutil) on npm, PyPI, RubyGems, or NuGet. When a developer mistypes, copies bad documentation, or relies on AI suggestions, the malicious package is installed and its post-install or import code runs payloads that steal tokens, plant backdoors, or drain crypto wallets. Defences include lockfiles, package allow-lists, dependency-review tools (Socket, Snyk, GitHub Dependency Review), strict CI policies for new dependencies, and registry-side namespace protections.
● Examples
- 01
crossenv on npm (vs the legitimate cross-env) shipped credential-stealing code in 2017.
- 02
python3-dateutil and jeIlyfish on PyPI in 2019 typosquatted popular libraries to steal SSH keys.
● Frequently asked questions
What is Typosquatted Package?
A malicious open-source package published under a name that closely resembles a popular library so that developers install it by mistake. It belongs to the Attacks & Threats category of cybersecurity.
What does Typosquatted Package mean?
A malicious open-source package published under a name that closely resembles a popular library so that developers install it by mistake.
How does Typosquatted Package work?
Typosquatted packages target the ecosystem-level autocomplete habits of developers. The attacker picks a widely used library — react, lodash, requests, cross-env, urllib3 — and publishes a malicious package with a tiny variation in the name (crossenv vs cross-env, python3-dateutil vs python-dateutil) on npm, PyPI, RubyGems, or NuGet. When a developer mistypes, copies bad documentation, or relies on AI suggestions, the malicious package is installed and its post-install or import code runs payloads that steal tokens, plant backdoors, or drain crypto wallets. Defences include lockfiles, package allow-lists, dependency-review tools (Socket, Snyk, GitHub Dependency Review), strict CI policies for new dependencies, and registry-side namespace protections.
How do you defend against Typosquatted Package?
Defences for Typosquatted Package typically combine technical controls and operational practices, as detailed in the full definition above.
What are other names for Typosquatted Package?
Common alternative names include: Package typosquatting, Name-confusion attack.
● Related terms
- attacks№ 647
Malicious npm Package
An npm package that contains hidden code designed to steal data, install malware, or compromise downstream applications when installed.
- attacks№ 1097
Starjacking
A supply-chain trick where a malicious package falsely links to a popular GitHub repository so it appears to inherit that project's stars, forks, and credibility.
- appsec№ 304
Dependency Confusion Attack
A supply-chain attack in which an adversary publishes a malicious package on a public registry with the same name as an organization's internal dependency, tricking build tools into pulling the public version.
- attacks№ 1116
Supply Chain Attack
An attack that compromises a trusted third-party software, hardware, or service provider in order to reach its downstream customers.
- attacks№ 868
Protestware
Open-source software whose maintainer adds politically motivated code that displays a message or sabotages users perceived to be in a targeted country.