Severity
Critical
Short Description
Package name is similar to other popular packages and may not be the package you want.
Packages
View packages with this alert.Suggestion
Use care when consuming similarly named packages and ensure that you did not intend to consume a different package. Malicious packages often publish using similar names as existing popular packages.
Typosquatting is a malicious practice where attackers create packages with names that are intentionally similar to popular, legitimate packages. These packages often have slight variations in spelling, capitalization, or punctuation. The goal is to trick developers into accidentally installing the malicious package instead of the intended one, thereby compromising the security of their projects.
The concern with typosquats is that they can introduce significant security risks to your project. Once installed, a typosquatting package can execute malicious code, steal sensitive information, or create backdoors for future attacks. Because these packages are designed to closely resemble legitimate ones, they can easily go unnoticed, leading to potential widespread impact.
Verify the Package Name:
package.json
file. Ensure that it matches the intended package exactly, including the correct case.Confirm the Package Source:
Compare with Known Packages:
Check for Similar Names:
Remove Malicious Packages:
Replace with the Correct Package:
package.json
file.When Socket detects a Typosquatting package, the alert also asks, "Did you mean [legitimate package name]?" In this example, the legitimate package is OAuth, which is downloaded 1.4 million times per week.
In another example, a package is typosquatting the Lodash utility library. The legitimate package is linked and it also displays a comparison of weekly downloads.
One of the most notorious package typosquatting incidents took place in 2019 when the Python security team had to take action against two malicious Python libraries found on PyPI. These libraries were designed to steal SSH and GPG keys from the developers' projects. The compromised packages were “python3-dateutil,” mimicking the widely-used “dateutil” library, and “jeIlyfish” (with the first 'L' replaced by an 'I'), which closely resembled the “jellyfish” library.
Socket fetches package with names similar to the target package, focusing on those with significantly higher download counts. It sorts these packages to prioritize the most likely typosquats, calculates the probability of each package being a typosquat, and flags packages if their probability exceeds a certain threshold.