Introduction

A malicious version of Anthropic's Claude Code VS Code extension was distributed through Cursor's extension marketplace for approximately 11 hours on October 29, exposing up to 5,000 developers to malware designed to install persistent SSH backdoors. This guide provides a comprehensive overview of the attack and steps to mitigate the risk.

Cursor VS Code Extension Malware Incident: Understanding the Attack and Mitigation Steps

Malicious Extension Details

The malicious extension, version 2.1.313, was distributed between 2:27 a.m. and 1:35 p.m. Pacific Time. The extension was used by Cursor, an AI-powered code editor built from Microsoft's open-source Visual Studio Code (VS Code), with support for VS Code extensions. Anthropic's Claude Code extension brings its AI coding assistant directly into compatible editors, helping developers write and debug code using natural-language instructions.

Attack Mechanism

The malicious code executed when the extension loaded, without requiring user interaction with Claude Code. The attackers inserted a malicious JavaScript loader at the beginning of the extension's extension.js file, leaving the legitimate extension code otherwise unchanged. The malicious code collected system and user information, including Git email and public IP address. It added an attacker-controlled SSH key and attempted to enable SSH access and establish a reverse tunnel. The malware installed persistence through a macOS LaunchAgent or Windows scheduled task/Startup script, retrying the tunnel roughly every minute. It also sent host details and backdoor status to the attacker's server at the IP address 134.209.82[.]225.

Analysis of the Malware

Researchers at Phorion and OpenSourceMalware found that the attackers inserted a malicious JavaScript loader at the beginning of the extension's extension.js file, leaving the legitimate extension code otherwise unchanged. The malicious code executed when the extension loaded, without requiring user interaction with Claude Code. The attackers inserted a malicious JavaScript loader at the beginning of the extension's extension.js file, leaving the legitimate extension code otherwise unchanged. The malicious code collected system and user information, including Git email and public IP address. It added an attacker-controlled SSH key and attempted to enable SSH access and establish a reverse tunnel. The malware installed persistence through a macOS LaunchAgent or Windows scheduled task/Startup script, retrying the tunnel roughly every minute. It also sent host details and backdoor status to the attacker's server at the IP address 134.209.82[.]225.

Impact and Mitigation

The malware was able to install its SSH keys, establish persistence, and attempt to create the reverse tunnel. However, because the SSH server was not already running, the tunnel could not provide access to the compromised device. The malware can still send reconnaissance data to the attacker's server, including the victim's username, hostname, public IP address, Git email address, and names of environment variables associated with sensitive credentials. However, the script does not directly steal credentials, suggesting the attackers intended to retrieve sensitive data manually after gaining access through the SSH tunnel.

Steps to Mitigate the Risk

Cursor removed the malicious extension and temporarily shut down its entire marketplace to audit other extensions and rotate all access keys before making it available again. The company also worked with the hosting provider to take the attacker's server offline, disrupting both the reverse SSH connections and the transmission of reconnaissance data. Following an internal investigation, Cursor says it found no evidence that any other extension versions or the official distribution were affected. Those who have downloaded the package during the exposure window should check for the presence of an 'svc-telemetry' SSH key on their machines, and follow Cursor’s remediation instructions if impact is confirmed. For impacted machines, it is recommended to isolate them, rotate accessible secrets, invalidate sessions, and change passwords.

Conclusion

The Cursor VS Code extension malware incident highlights the importance of thorough security audits and the need for developers to be vigilant about the extensions they install. By understanding the attack and following the mitigation steps, developers can better protect themselves and their systems from similar threats in the future.

Code Cursor Extension Incident Malware