---
title: "记一次 Cursor 市场 Claude Code 扩展投毒事件：2.1.313 版本分析与本地排查"
url: "https://afengblog.com/blog/cursor-claude-code-extension-2-1-313-backdoor.html"
author: "AFeng"
published: "2026-10-30T15:01:31.600Z"
category: "安全与隐私"
tags: ["网络安全","Cursor","Claude Code","供应链安全","SSH"]
reading_time: "12 分钟阅读"
description: "2026年10月29日至30日，Cursor 扩展市场中的 Anthropic.claude-code（2.1.313 版本）遭篡改并植入持久化 SSH 后门。本文详解被注入的 66 行恶意代码行为（写入 svc-telemetry 公钥、跨平台自启与回传主机信息），并提供本地快速自查命令与清理步骤。"
---

# 记一次 Cursor 市场 Claude Code 扩展投毒事件：2.1.313 版本分析与本地排查

> 2026年10月29日至30日期间，Cursor 扩展市场中的 Anthropic.claude-code（2.1.313 版本）遭到篡改并被植入了 SSH 后门。本文梳理了这次事件的实际影响范围、那 66 行恶意代码的具体行为，以及本地环境的快速自查和清理方法。

## TL;DR（太长不看）

- 仅在北京时间 2026年10月29日 17:27 至 10月30日 04:35 期间通过 Cursor 扩展市场安装或更新 Anthropic.claude-code 2.1.313 的用户受影响；VS Code 官方市场、Open VSX 与 npm CLI 均安全
- 恶意版本在 extension.js 头部注入 66 行代码，后台静默写入带 svc-telemetry 注释的 SSH 公钥、配置跨平台开机自启，并向 C2 回传主机环境与敏感环境变量名称
- 终端检查 ~/.ssh/authorized_keys 是否含 svc-telemetry 即可自查；若命中需运行官方清理脚本清除后台自启项、更新至 2.1.314+ 并轮换敏感凭据

如果你在 **北京时间 2026年10月29日 17:27 至 10月30日 04:35** 期间，用 **Cursor** 安装或自动更新过 `Anthropic.claude-code` 扩展（中招版本为 **`2.1.313`**），你的机器可能被写入了攻击者的 SSH 公钥和后台自启脚本[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)]。微软官方 VS Code 市场、Open VSX 以及 npm 上的官方 CLI 包均未受影响[[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)]。

你可以直接去终端跑一下这行命令，看看 `~/.ssh/authorized_keys` 里有没有多出一个叫 `svc-telemetry` 的公钥[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)]：

```bash
# macOS / Linux
grep -qs svc-telemetry ~/.ssh/authorized_keys && echo "【警告】发现恶意密钥，机器已受影响！" || echo "未发现异常"
```

```powershell
# Windows PowerShell
$files = "$HOME\.ssh\authorized_keys", "C:\ProgramData\ssh\administrators_authorized_keys" | Where-Object { Test-Path $_ }
if ($files -and (Select-String svc-telemetry $files)) { "【警告】发现恶意密钥，机器已受影响！" } else { "未发现异常" }
```

如果显示未发现异常，把扩展更新到 `2.1.314` 以上就可以继续干活了[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)][[4](https://thehackernews.com/2026/10/official-claude-code-vs-code-extension.html)]；如果命中了警告，光卸载插件没用，请往下看具体的清理步骤[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)]。

![Cursor 扩展市场 Claude Code 2.1.313 投毒事件分析与排查封面](https://afengblog.com/uploads/2026/10/3406a913e12015b2de1f9a82.webp)

## 事件来龙去脉与影响范围

这两天安全圈和开发者社区都在传 Claude Code 扩展被投毒的事。最开始消息比较乱，有人说是 Open VSX 被黑了，也有人怀疑是微软官方市场或者 Anthropic 自己的发布流水线出了问题[[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)]。随着 OpenSourceMalware、Phorion 等安全机构以及 Cursor 官方公告的披露，事情的来龙去脉已经彻底理清了[[1](https://phorion.io/blog/offical-claude-code-vsx-compromise/)][[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)][[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)]。

这次出问题的地方，其实只在 **Cursor IDE 自建的扩展市场（Cursor Extension Marketplace）**[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)][[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)]。Anthropic 源码和构建流水线是干净的，平时用原版 VS Code、从 Open VSX 下插件，或者只在终端里用 npm 跑 `@anthropic-ai/claude-code` 的朋友完全不用担心[[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)]。

出问题的扩展包版本是 `2.1.313`，在太平洋时间 10月29日 02:27 到 13:35（也就是北京时间 10月29日下午五点半到次日凌晨四点半左右）处于可下载状态[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)]。根据官方统计，大概有最多 5000 名在这个时间段内打开 Cursor 安装或自动更新了该扩展的用户受到了波及[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)][[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)]。发现问题后，官方很快用干净的 `2.1.314` 版本替换了问题包[[4](https://thehackernews.com/2026/10/official-claude-code-vs-code-extension.html)]。

## 恶意代码具体干了什么

攻击者的手法并不复杂，就是在正常扩展的主文件 `extension.js` 最前面硬塞了 66 行 JavaScript 代码[[4](https://thehackernews.com/2026/10/official-claude-code-vs-code-extension.html)][[5](https://www.binance.com/en/square/post/382784682398730)]。这段代码把所有报错都用异常捕获静默吞掉了，所以插件用起来跟平时一模一样，甚至不需要你真正去跟 Claude 发起对话，只要启动编辑器或者打开 Webview 就会在后台触发[[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)][[5](https://www.binance.com/en/square/post/382784682398730)]。

触发之后，它主要在后台干三件事：**留后门、写自启、发机器信息。**

![Claude Code 2.1.313 恶意扩展留后门写自启与发信息三步行为解析](https://afengblog.com/uploads/2026/10/faff5a25983d76d47ffe3197.webp)

首先是留 SSH 后门。代码会往你本地的 `~/.ssh/authorized_keys` 文件里追加一条 Ed25519 公钥，为了看着像正常配置，它还特意加了个 `svc-telemetry` 的注释伪装成系统遥测[[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)]。接着它会尝试在你的机器上开启本地 SSH 服务（比如在 macOS 上调 `systemsetup -setremotelogin on`，在 Windows 上用 PowerShell 装 `OpenSSH.Server`），同时在临时目录释放一个以 `.stk_` 开头的十位十六进制私钥文件，尝试用 `ssh -N -R` 或 `autossh` 往攻击者的服务器 `tunnel@134.209.82.225`（端口 22）打一条反向隧道[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)][[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)]。

不幸中的万幸是，在默认配置的 macOS 和 Windows 上，开启系统级 SSH 服务是需要管理员权限的，外加攻击者写的这段代码本身也有点 Bug[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)]。所以除非你平时习惯用管理员权限去跑 Cursor，或者你机器本来就开着 SSH 服务，否则开启本地 SSH 这一步大概率会直接失败，攻击者也没法真的顺着隧道连进你的电脑[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)]。

虽然反向登录不一定能成，但前面提到的写公钥、写开机自启和收集信息这几步，在普通用户权限下就已经能跑通了[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)]。

为了让隧道断了也能重连（每 60 秒重试一次），脚本针对不同系统都做了自启动配置[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)][[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)]。在 macOS 上，它会生成 `~/.config/.smt` 和 `~/.config/.smtk`，并在 `~/Library/LaunchAgents/` 下塞一个叫 `com.apple.sysmond.plist` 的文件，伪装成苹果自带的系统进程[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)][[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)]。在 Windows 上，它会在用户目录的 `.config` 下建 `smt.cmd` 和 `smtk`，尝试注册名为 `SysMon` 的计划任务，同时往开机启动文件夹（`Startup`）里放一个 `sysmon.cmd` 保底[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)]。在 Linux 上则是直接往用户的 crontab 里写一条 `@reboot` 任务[[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)]。

与此同时，它还会收集一轮你的本地环境信息，通过明文 HTTP POST 发给 `http://134.209.82.225:8099/beacon`[[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)][[4](https://thehackernews.com/2026/10/official-claude-code-vs-code-extension.html)]。发出去的内容包括你的公网 IP、主机名、本地用户名、操作系统和 CPU 架构、主目录和当前工作目录路径，以及你全局配置的 Git 邮箱（`git config --global user.email`）[[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)][[4](https://thehackernews.com/2026/10/official-claude-code-vs-code-extension.html)]。比较讨厌的是，它还会扫描你的环境变量，把名字里带有 `KEY`、`TOKEN`、`SECRET`、`PASS`、`AWS`、`GCP` 的环境变量筛出来（最多 40 个）一并发过去[[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)][[4](https://thehackernews.com/2026/10/official-claude-code-vs-code-extension.html)]。好在这次初始包里它只传了环境变量的**名称**用来摸底，还没有直接把变量的值传走[[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)][[4](https://thehackernews.com/2026/10/official-claude-code-vs-code-extension.html)]。

## 中招之后怎么清理

![Cursor 恶意扩展本地环境自查与应急清理步骤](https://afengblog.com/uploads/2026/10/82bc426d19ef600d2c52ee54.webp)

如果你跑了文章开头的自查命令，发现文件里确实有 `svc-telemetry`，切记**不要只去编辑器里把扩展卸载了事**，因为那些写进系统自启目录的脚本已经脱离编辑器独立在后台跑了[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)]。

最省事的办法是直接用 Cursor 官方在安全公告里提供的清理脚本[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)]：

- **macOS 脚本：** [remediate-macos.sh](https://cursor.com/static/security/claude-code-extension/remediate-macos.sh)
- **Windows 脚本（需管理员权限运行）：** [remediate-windows.ps1](https://cursor.com/static/security/claude-code-extension/remediate-windows.ps1)

如果你更习惯自己动手清理，或者在用 Linux，可以按下面的路径逐个删干净：

- **清理 SSH 公钥：** 打开 `~/.ssh/authorized_keys`（Windows 用户还要看一眼 `C:\ProgramData\ssh\administrators_authorized_keys`），把末尾带有 `svc-telemetry` 注释的那整行公钥删掉（该密钥指纹为 `SHA256:0Z6R+DF64Do2nwQic8a7kkfDLNNk4IiK+2U2Rci4htk`）[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)]。
- **清理各系统的自启项与残留文件：**
  - **macOS：** 卸载并删除 `~/Library/LaunchAgents/com.apple.sysmond.plist`，删掉 `~/.config/.smt`、`~/.config/.smtk` 以及 `$TMPDIR/.stk_*` 临时文件[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)]。
  - **Windows：** 删掉计划任务里的 `SysMon`，删除 `%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\sysmon.cmd`、`%USERPROFILE%\.config\smt.cmd`、`%USERPROFILE%\.config\smtk` 以及 `%TEMP%\.stk_*` 文件[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)]。
  - **Linux：** 执行 `crontab -e` 删掉异常的 `@reboot` 任务，并清理 `~/.config/.smt*` 相关文件[[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)]。
- **杀进程与更新：** 看一下后台有没有残留的 `ssh -N -R` 或 `autossh` 进程，有的话直接 kill 掉，最后把 Cursor 里的 Claude Code 扩展更新到 `2.1.314` 或更高版本[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)][[4](https://thehackernews.com/2026/10/official-claude-code-vs-code-extension.html)]。

目前 Cursor 官方已经联合云厂商把攻击者的那台 C2 服务器（`134.209.82.225`）给拔线了[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)]。如果是公司内网环境，安全团队还是可以在边界防火墙上把这个 IP 的 22 和 8099 端口封一下，顺带查查这两天有没有机器往这个地址发过请求[[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)]。

另外多提一句，如果你的机器命中了恶意公钥，而且你平时本来就开着机器的 SSH 服务（或者用管理员权限跑了 Cursor），那就不能当成普通未遂事件处理了[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)]。为了稳妥起见，建议换一台干净的设备，把这台机器上存过的本地 SSH 私钥、Git Token、AWS/GCP 等云平台密钥和各类 API Key 全部轮换一遍[[2](https://cursor.com/cn/blog/claude-code-extension-security-notice)][[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)]。要是机器上有特别核心的业务凭证，直接重装系统会更踏实[[3](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)]。

## 参考来源

1. [Official Claude Code VSX Compromise Analysis · Phorion](https://phorion.io/blog/offical-claude-code-vsx-compromise/)
2. [Security notice — malicious version of Anthropic.claude-code (2.1.313) identified in the Cursor Extension Marketplace · Cursor](https://cursor.com/cn/blog/claude-code-extension-security-notice)
3. [Claude Code Extension 2.1.313 SSH Backdoor: What To Check · ExplainX](https://explainx.ai/blog/claude-code-extension-trojanized-2-1-313-cursor-marketplace-ssh-backdoor-what-is-confirmed-2026)
4. [Official Claude Code VS Code Extension Compromised to Install Persistent SSH Backdoor · The Hacker News](https://thehackernews.com/2026/10/official-claude-code-vs-code-extension.html)
5. [Claude Code Extension Security Incident Report · Binance Square](https://www.binance.com/en/square/post/382784682398730)

标签：[网络安全](https://afengblog.com/tag/cybersecurity)、[Cursor](https://afengblog.com/tag/cursor)、[Claude Code](https://afengblog.com/tag/claude-code)、[供应链安全](https://afengblog.com/tag/supply-chain-security)、[SSH](https://afengblog.com/tag/ssh)

---

原文：https://afengblog.com/blog/cursor-claude-code-extension-2-1-313-backdoor.html

其他页面同样支持在 URL 后追加 `.md` 获取 Markdown，站点索引见 https://afengblog.com/llms.txt
