Inside a malicious Claude Code-branded extension and its persistent SSH backdoor | Microsoft Security Blog
A tampered Claude Code extension in Cursor's marketplace installed a persistent SSH backdoor by injecting attacker-controlled keys and reverse tunnels across macOS, Linux, and Windows hosts. The malicious extension (anthropic.claude-code v2.1.312/2.1.313) was live in Cursor's marketplace for ~11 hours. Its injected JavaScript adds an Ed25519 SSH key labeled svc-telemetry, creates reverse SSH tunnels to 134.209.82.225, and writes platform-specific persistence scripts outside the extension directory. SSH access was blocked on most hosts, but key planting and persistence artifacts may persist even after extension removal.
Authors: Microsoft Threat Intelligence
Source:Microsoft
Detection / HunterZ.ai
Immediate Actions
- Identify systems that installed anthropic.claude-code v2.1.312 or v2.1.313 from Cursor marketplace.
- Isolate devices with evidence of loader execution or backdoor installation.
- Remove trojanized extension and all persistence artifacts from IOC table.
- Rotate credentials and revoke sessions when telemetry indicates exposure.
Key Takeaways
- Versions 2.1.312 and 2.1.313 were live in Cursor marketplace Oct 29, 2:27 AM–1:35 PM PDT
- Microsoft VS Marketplace and npm @anthropic-ai/claude-code were not affected
- Anthropic confirmed their systems were not compromised and did not develop the malicious package
- Loader collects up to 40 environment-variable names matching KEY, TOKEN, SECRET, PASS, AWS, or GCP
- Persistence uses names resembling system monitors (SysMon, com.apple.sysmond) to evade suspicion
Attack Chain
- Initial Access: Malicious extension installed or auto-updated from Cursor marketplace
- Execution: Injected JavaScript runs before extension initialization, collecting host recon
- Persistence: SSH key appended to authorized_keys with comment svc-telemetry
- Command and Control: Reverse SSH tunnel established to 134[.]209[.]82[.]225
- Persistence: Platform-specific startup scripts written outside extension directory
- Exfiltration: Delayed callback sends host details and matching env var names
Affected Systems
- macOS systems with Cursor IDE and Claude Code extension
- Linux systems with Cursor IDE and Claude Code extension
- Windows systems with Cursor IDE and Claude Code extension
- anthropic.claude-code extension versions 2.1.312 and 2.1.313
- Cursor Extension Marketplace users with auto-update enabled
Detection Availability
- Published: KQL
- Platforms: Microsoft Defender XDR, Microsoft Defender Antivirus
KQL advanced hunting queries, Defender XDR detections, and Defender Antivirus signatures available in blog post.
Detection Engineering Assessment
Hunting Hypotheses
| Hypothesis | Telemetry | Stage | FP Risk |
|---|---|---|---|
| Hunt for SSH processes with reverse tunnel arguments spawned by code editor or extension processes (T1572) | Process command-line and network connection logs | Command and Control | Low — reverse tunnel from IDE is unusual |
| Hunt for authorized_keys modifications containing the comment svc-telemetry (T1098.004) | File modification events on SSH authorized_keys | Persistence | Low — specific comment marker |
| Hunt for LaunchAgent or Startup folder entries created by code editor processes (T1543.001, T1547.001) | Plist, scheduled task, and file creation events | Persistence | Medium — developers may create tasks |
| Hunt for hidden files matching .stk_ prefix in user home or temp directories (T1564.001) | File creation events with .stk_ filename prefix | Command and Control | Low — non-standard pattern |
Required Log Sources
- DeviceNetworkEvents (Microsoft Defender XDR)
- DeviceFileEvents (Microsoft Defender XDR)
- DeviceEvents (Microsoft Defender XDR)
- SSH authentication logs
- Cursor extension install logs
- Process creation command-line logs
Control Gaps
- Extension marketplace lacked publisher verification at publication time
- SSH host-key checking bypassed by loader configuration
- Persistence artifacts written outside extension installation directory
- Extension auto-update installed malicious versions without delay
Recommendations
Infrastructure Hardening
- Restrict Cursor extensions to approved publishers and enable installation cooldown.
- Block outbound SSH connections from developer workstations to non-approved destinations.
- Monitor authorized_keys file modifications across all managed endpoints.
- Verify Claude Code extension source is Microsoft VS Marketplace or npm.
User Protection
- Disable extension auto-update in environments without publisher verification.
- Verify extension publisher identity before installation on developer workstations.
- Remove leftover persistence artifacts after extension removal; updating does not clean them.
MITRE ATT&CK Mapping
- file_path%APPDATA%\Microsoft\Windows\StartMenu\Programs\Startup\sysmon.cmdWindows Startup folder fallback script
- file_path~/.config/.smtUnix persistence script for SSH retry
- file_path~/.config/.smtkUnix tunnel identity file
- file_path~/Library/LaunchAgents/com.apple.sysmond.plistmacOS LaunchAgent persistence artifact
- file_path%USERPROFILE%\.config\smt.cmdWindows persistence batch script
- file_path%USERPROFILE%\.config\smtkWindows tunnel identity file
- ip134[.]209[.]82[.]225C2 SSH and HTTP destination server
- sha2567e0a52885fadee05544a9e99eb18c792bec05900a5e1a66d68f8383decb0e278Decoded tunnel private key file hash
- sha256ecb58cb29078d9646ad1dcdbe51526f2d9cfea06be5fb2ab183e8ecc3ab6bf15Malicious JavaScript entry point hash
- urlhxxp://134[.]209[.]82[.]225:8099/beaconRecon reporting endpoint for host details