#TL;DR
Phorion discovered that versions 2.1.312 and 2.1.313 of the official Claude Code extension for VS Code, distributed through the Cursor Marketplace, contain a hidden payload that drops an SSH key into ~/.ssh/authorized_keys and opens a reverse SSH tunnel to an attacker‑controlled server. The implant runs as soon as the extension’s JavaScript bundle is loaded, needs no user interaction, and attempts to enable the system SSH daemon on macOS, Linux, and Windows. Cursor has removed the affected versions, but any organization that installed them should assume compromise, audit for the artifacts, and rotate keys immediately.
#What’s new
| Aspect | Details |
|---|---|
| Affected package | Claude Code VS Code extension (Cursor Marketplace) – versions 2.1.312 and 2.1.313 |
| Malicious behavior | • Injected IIFE runs on module load • Creates ~/.ssh/authorized_keys entry with attacker‑controlled Ed25519 public key (comment svc‑telemetry) • Writes an embedded private key to a temporary file (.stk_<hash>) • Attempts to enable the local SSH daemon (systemsetup on macOS, systemctl/service on Linux, PowerShell on Windows) • Opens a reverse tunnel (ssh -N -R *:0:localhost:22) to 134.209.82.225 |
| Persistence | The authorized‑keys entry and the temporary tunnel key survive reboots. The tunnel process is launched each time the extension is activated. |
| Platform coverage | macOS, Linux, Windows – implementation differs per OS, with a logic bug on macOS that may skip the systemsetup -setremotelogin on step when the user lacks admin rights. |
| Discovery timeline | - 30 Oct 2024 05:30 UTC: Phorion publishes analysis - 30 Oct 2024 09:13 UTC: Cursor corrects marketplace reference - 31 Oct 2024 00:43 UTC: Cursor adds version 2.1.312 to the list of removed releases |
| Impact | Any developer who installed the compromised extension can be accessed remotely with full shell rights, exposing source code, credentials, and any other files the user can read. |
The backdoor is not a “feature” of Claude Code; it is a supply‑chain compromise of the extension bundle. Because VS Code extensions execute with the same privileges as the user running the IDE, the payload gains immediate access to the developer’s environment.
#How it compares
| Criterion | Claude Code backdoor | Typical legitimate VS Code extensions |
|---|---|---|
| Code signing | No valid signature verification on the Cursor Marketplace; the malicious IIFE is hidden inside the minified bundle. | Most reputable extensions are signed and undergo marketplace review. |
| Execution model | Runs automatically on require of extension.js, before the extension’s activate hook. |
Normal extensions run user‑code only after the user opens the extension UI or triggers a command. |
| Privilege escalation | Relies on existing user privileges; attempts non‑interactive sudo -n or systemctl without exploiting a vulnerability. |
Legitimate extensions rarely invoke system services; they operate within the IDE sandbox. |
| Persistence mechanism | Writes to ~/.ssh/authorized_keys and creates a hidden temporary key file; launches a background SSH process. |
Legitimate extensions may store settings in the workspace or extension storage, but not system SSH files. |
| Detection surface | - Modified extension.js with an extra IIFE - New Ed25519 public key in authorized_keys - Temporary file .stk_<hash> in $TMP - Outbound SSH process to IP 134.209.82.225 |
- Extension metadata in package.json - No unexpected system‑level side effects. |
In short, the backdoor behaves like a classic supply‑chain implant: it piggybacks on a trusted developer tool, executes silently, and establishes a covert command‑and‑control channel. The only “defence” built into the payload is a bug in the macOS SSH enable check, which may unintentionally reduce exposure on systems where Remote Login is disabled. That bug should not be relied upon as a mitigation.
#How to try it (detecting the compromise)
Below is a minimal Node.js script you can run on any workstation to check for the known indicators of compromise (IOCs). It does not install anything; it only reads files and enumerates processes.
// detect-claude-backdoor.js
const fs = require('fs');
const os = require('os');
const path = require('path');
const { execSync } = require('child_process');
function hasBackdoorKey() {
const authFile = path.join(os.homedir(), '.ssh', 'authorized_keys');
if (!fs.existsSync(authFile)) return false;
const content = fs.readFileSync(authFile, 'utf8');
return /svc-telemetry/.test(content);
}
function hasTunnelKey() {
const tmpDir = os.tmpdir();
const files = fs.readdirSync(tmpDir);
return files.some(f => f.startsWith('.stk_'));
}
function hasOutboundSSH() {
try {
const out = execSync('ps -eo pid,command | grep "[s]sh -N -R"', { encoding: 'utf8' });
return out.includes('134.209.82.225');
} catch (_) {
return false;
}
}
console.log('=== Claude Code backdoor scan ===');
console.log('Authorized‑keys contains backdoor key:', hasBackdoorKey());
console.log('Temporary tunnel key file present:', hasTunnelKey());
console.log('Outbound reverse‑SSH process running:', hasOutboundSSH());
How to use
node detect-claude-backdoor.js
If any of the three checks return true, the host is likely compromised and you should:
- Terminate the offending SSH process (
kill <pid>). - Remove the malicious key from
~/.ssh/authorized_keys. - Delete any
.stk_*files from the temporary directory. - Rotate all SSH keys that may have been used on the machine.
- Re‑install the Claude Code extension from a trusted source (e.g., the official Anthropic VS Code marketplace, not the Cursor Marketplace).
For large fleets, embed the script in a CI/CD or endpoint‑management tool and run it across all developer workstations.
#Limitations and open questions
| Area | Current knowledge | Open questions |
|---|---|---|
| Root cause of the supply‑chain breach | Phorion identified the malicious IIFE inside the bundled extension.js. The exact point of injection (build pipeline, compromised developer account, or malicious third‑party library) has not been disclosed. |
Who inserted the payload, and how can the build process be hardened to prevent future tampering? |
| Persistence beyond SSH | The backdoor drops a key and a tunnel. No evidence of additional payloads (e.g., credential stealers) was found in the analyzed versions. | Could later updates add more sophisticated modules, or does the attacker plan to push staged payloads? |
| Effectiveness of the macOS bug | The script incorrectly treats a “permission‑denied” message as “Remote Login already on”, so the sudo step is skipped on standard users. |
On macOS machines where Remote Login is already enabled, does the backdoor reliably open the inbound port, or are there other OS‑level defenses (e.g., SIP) that block it? |
| Detection at the marketplace level | Cursor removed the affected versions after the report. The marketplace currently does not enforce mandatory code‑signing for extensions. | Will Cursor adopt stricter vetting (e.g., reproducible builds, signature verification) for future extensions? |
| Impact on CI/CD pipelines | If a CI runner installs the compromised extension, the backdoor could gain access to build secrets. | Have any CI environments reported anomalous SSH connections to the attacker IP? |
Until these questions are answered, the safest stance is to treat any installation of the affected versions as a breach and to assume that the attacker can reach the host at any time.
#Key takeaways
- Versions 2.1.312 and 2.1.313 of the Claude Code VS Code extension on the Cursor Marketplace contain a hidden IIFE that installs a persistent SSH backdoor on macOS, Linux, and Windows.
- The payload drops an attacker‑controlled public key (
svc‑telemetry) into~/.ssh/authorized_keysand opens a reverse tunnel to134.209.82.225. - macOS logic mistakenly skips enabling Remote Login when run without admin rights, but the backdoor remains usable if SSH is already on or later enabled.
- Immediate remediation steps: terminate the tunnel process, delete the malicious keys/files, rotate all SSH credentials, and reinstall the extension from a trusted source.
- Organizations should audit all developer machines for the three IOCs (authorized‑keys entry,
.stk_*file, outbound SSH process) and integrate automated detection into endpoint management. - The incident highlights the need for stricter supply‑chain controls on IDE extensions, including code signing, reproducible builds, and marketplace vetting.
#FAQ
Q1. Is the backdoor limited to Claude Code users, or could any VS Code extension be compromised in the same way?
A: The malicious code was injected only into the Claude Code bundle distributed via the Cursor Marketplace. However, the attack vector—tampering with the extension package before it reaches the marketplace—is generic. Any VS Code extension that bypasses code‑signing checks could be used for a similar supply‑chain implant.
Q2. Do I need admin rights on my machine to be affected?
A: No. The payload runs as the current user, which is sufficient to write to ~/.ssh/authorized_keys and launch an outbound SSH process. Enabling the local SSH daemon may fail without sudo, but the backdoor still works if Remote Login is already on or later enabled.
Q3. Can I still use Claude Code safely?
A: Yes, but install it from a trusted source (e.g., the official Anthropic VS Code marketplace) and verify the package checksum. Avoid the Cursor Marketplace until it implements stricter security controls.

Comments
No comments yet. Start the conversation.