Malicious npm Package Typosquats Popular TypeScript ESLint Plugin, Exfiltrates Data and Enables Remote Exploitation
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Socket Research Team
December 11, 2024
Weaponizing trust in the open source ecosystem is the bread and butter of threat actors who leverage typosquatting to infiltrate development environments and gain unauthorized access. In this research post we're breaking down a malicious npm package targeting developers attempting to install the popular @typescript-eslint/eslint-plugin package, an ESLint plugin specifically for TypeScript code.
The malicious package, @typescript_eslinter/eslint, differs from the legitimate package name by just a few subtle changes. Developers may accidentally install the plugin thinking they were getting type-aware linting and code style enforcement but instead have their systems compromised.
In this post we will dissect the malicious package's functionality and its connection to a live secondary payload:
By leveraging typosquatting and chaining malicious packages, the attackers compromised development environments, exposing sensitive data like API keys, credentials, and configuration files.
A WebSocket server enabled real-time exploitation, allowing the attackers to exfiltrate data and execute commands dynamically on affected systems.
The presence of a secondary payload, @typescript_eslinter/prettier, which remains live on npm, underscores the persistent nature of this threat.
Beyond the immediate technical risks, the attack also erodes trust in open source repositories, undermining confidence in the tools developers rely on daily.
It performs clipboard monitoring, global keyboard logging (on Windows), and remote shell command execution via WebSocket. It copies itself to the startup folder for persistence and periodically sends collected data to a remote server. It supports cross-platform functionality (Windows, Linux, macOS)
The legitimate @typescript-eslint/eslint-plugin is a cornerstone of TypeScript development. It integrates seamlessly with ESLint, enabling developers to enforce coding standards and prevent bugs in TypeScript projects. Its popularity is immense:
3+ million weekly downloads.
15,000+ stars on GitHub.
Used extensively in production environments and CI/CD pipelines.
Such widespread usage made it an ideal target for typosquatting, a technique where attackers create malicious packages with names similar to legitimate ones to deceive developers.
The Malicious Package: @typescript_eslinter/eslint#
On November 17th, a malicious package named @typescript_eslinter/eslint was published on npm. This package mimicked the legitimate @typescript-eslint/eslint-plugin, targeting developers who might mistype or misread the package name. It released 43 versions within two weeks—a tactic likely aimed at evading detection by automated tools. The package was eventually removed on December 1, but not before it executed a sophisticated attack chain.
The Secondary Payload: @typescript_eslinter/prettier#
In addition to @typescript_eslinter/eslint, the attackers also published another malicious package, @typescript_eslinter/prettier, which acts as a secondary payload. This package remains live on npm and is designed to spread and enhance the malicious functionality of the primary package.
Ensures the malicious code runs every time the system restarts.
Embeds itself deeply into the system.
3. Real-Time Communication with Command-and-Control Server
Reversing strings and Base64 encoding is a common evasion technique used in malicious scripts to hide sensitive data like URLs or IPs. The string is first reversed, encoded in Base64, and then dynamically decoded at runtime. This obfuscation evades static analysis, hides malicious intent in the raw script, and ensures that critical data (e.g., command-and-control servers) remain concealed until execution, making detection more challenging for both automated tools and manual inspection.
Prevents developers from using legitimate linting tools.
Replaces trusted processes with malicious ones.
The impact of this attack is far-reaching and multifaceted. Developers unknowingly introduced malicious code into their workflows, putting sensitive project data and credentials at significant risk. Through a WebSocket connection, attackers gained the ability to dynamically issue commands, steal data, and execute additional payloads in real time.
The attack's potential reach was amplified by the widespread use of @typescript-eslint/eslint-plugin, leaving countless systems vulnerable. Adding to the concern, the secondary malicious package, @typescript_eslinter/prettier, remains live on npm, continuing to pose a persistent threat to developers and projects. The IP address 135.181.226.254 is associated with Hetzner Online GmbH, a German-based hosting service provider. This server is located in Finland, specifically in the Tuusula data center.
Conclusion
The malicious package @typescript_eslinter/eslint is another example of attackers exploiting open source ecosystems, leveraging typosquatting and sophisticated payload chains. While the primary package has been removed from npm, its secondary payload @typescript_eslinter/prettier remains live, posing a continued threat. This attack demonstrates the importance of having typosquatting detection in place, which is available in the free Socket for GitHub app and our Safe npm CLI tool. These tools block open source supply chain attacks and flag 60+ other indicators of supply chain risk and code quality issues.
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.
The Socket Research Team investigates a malicious Python typosquat of a popular password library that forces Windows shutdowns when input is incorrect.