GUIDE · HOW-TO 11 min ·

Recover from the backdoored Cursor Claude Code extensionEvidence first, then cleanup, then rotation

A clean result from Cursor's check says one marker is absent, and its cleanup scripts delete the files you need to decide what to rotate. Save the artifacts first, search for the key material, read your SSH logs for loopback logins, then clean up and rotate from another machine.

TL;DR· the answer, in twenty seconds

What happened: Tampered builds of the Claude Code extension, versions 2.1.312 and 2.1.313, sat in Cursor's marketplace for about 11 hours on October 29. They added an SSH key, installed persistence, tried to open a reverse tunnel and sent host details, including environment variable names.

The minimum fix: Save the artifacts, search for the key material, read your SSH logs for loopback logins, run Cursor's script, turn off any SSH service you did not choose, then rotate from a clean device.

The lesson: Uninstalling removes the extension's own directory and nothing else. A host with SSH on and no log coverage for the window gets a rebuild.

Between about 2:27 a.m. and 1:35 p.m. Pacific on October 29, 2026, Cursor's extension marketplace served tampered builds of the Claude Code extension that added an SSH key to the user's account, installed persistence and tried to open a reverse tunnel.

Cursor's notice names Anthropic.claude-code 2.1.312 and 2.1.313 on macOS and Windows, and OX Security also puts availability at about 11 hours. Microsoft reports that these builds never reached the Visual Studio Marketplace or the npm package, and that Anthropic confirmed its systems were not compromised. The Hacker News gives 2.1.314 as the clean version, quotes Cursor putting the impact at "at most 5,000 users" (the current notice has no such figure) and reports that nobody has explained how the attacker got publish access.

Cursor says the hosting provider took the attacker's server offline, so the reverse shell and the beacon no longer work. That stops new sessions and leaves the earlier ones unanswered, because the notice gives no time for the takedown. Microsoft notes that neither the takedown nor an update removes artifacts from the device, and the background scripts keep retrying the tunnel about every 60 seconds until something kills them.

I tested the commands below on macOS 27.0.1 with OpenSSH 10.3p1, using fixture files, generated keys and a throwaway sshd bound to loopback. I read both of Cursor's scripts as published on November 7 and did not run either one whole. I had no affected host and no Windows or Linux machine, and I mark commands for those systems as untested.

A clean grep does not clear the machine

Cursor's check looks for one word:

grep -qs svc-telemetry ~/.ssh/authorized_keys && echo "svc-telemetry key found" || echo "No key found; machine not impacted"

A hit tells you something. The miss message claims more than the command can show, and Microsoft disagrees with it: a missing marker "should not replace review" of installation, process, network and persistence evidence. Someone may have removed the line already, and removing it undoes nothing else the extension did. Another account on the machine may have run Cursor.

Phorion points out that the malware's own guard tests for the comment and recommends hunting by fingerprint. The fingerprint has a blind spot of its own. A comment in Cursor's macOS script says the key is appended without a leading newline, so it can land on the same line as a real key. I built all three cases using the published key and ran each check:

authorized_keys state grep svc-telemetry ssh-keygen -lf fingerprint grep -F on key blob
Key on its own line found found found
Comment changed missed found found
Sharing a line with a real key found missed found

Search for the key blob, then read every other key on the list:

grep -nF 'AAAAC3NzaC1lZDI1NTE5AAAAIDdvylCEJ/k2TpezcTfedrkHyFSK9IZ3vmP6vhY4Ss0P' ~/.ssh/authorized_keys
ssh-keygen -lf ~/.ssh/authorized_keys

The second command matters for a reason no indicator list covers. An attacker who reached a shell can add a key you have never seen, so question any line you cannot name.

The shared line has two consequences. In my test with generated keys, sshd refused the appended key (ssh exit 255) and accepted the real one, because it reads the rest of that line as a comment. So that key would not have worked as a login, though the persistence and the beacon are separate steps and may still have run. And a grep -v cleanup deletes your real key along with it: my fixture went from one line to zero. Use Cursor's script or a careful hand edit.

Then look for the rest of the chain, for every account that used Cursor:

ls -la ~/.config/.smt ~/.config/.smtk ~/Library/LaunchAgents/com.apple.sysmond.plist
launchctl print "gui/$(id -u)/com.apple.sysmond"
pgrep -fl '/\.stk_[0-9a-f]{10}|/\.config/\.smtk|^/bin/sh .*/\.config/\.smt$'
grep -lF svc-telemetry ~/.[!.]*/extensions/anthropic.claude-code-*/extension.js

Search the extension by content. Cursor's script comments say the tampered bundle keeps the real version number, and the glob covers any editor that stores extensions under ~/.<name>/extensions. In zsh, no matches found on that last line means no such directory exists. The pgrep pattern comes from Cursor's script. On my test machine, all four reported nothing found.

On Windows, Cursor's check covers $HOME\.ssh\authorized_keys and C:\ProgramData\ssh\administrators_authorized_keys. The other Windows indicators are %USERPROFILE%\.config\smt.cmd, %USERPROFILE%\.config\smtk, %TEMP%\.stk_*, a scheduled task named SysMon and a Startup entry named sysmon.cmd.

Treat any hit as an affected machine. Treat no hits on a machine that had the extension during the window as "no known marker" and keep going.

Save the evidence before anything deletes it

Cursor's macOS script runs rm -rf on the extension directory, rm -f on the dropped files and pkill on the tunnel processes. The Windows script keeps no copy either. Microsoft says to preserve the extension package, modified SSH files, generated keys, scripts and startup configuration before cleanup. Live state goes first: a dead process takes its start time, parent and connections with it.

This script copies and deletes nothing. Run it with bash on macOS, as the affected user, before any cleanup. Cursor tells you to isolate hosts with evidence, and I would do that right after this script finishes, because pulling the network first drops the connections tcp.txt is there to record.

#!/usr/bin/env bash
# Run as the affected user, before any cleanup. Copies; deletes nothing.
set -u
shopt -s nullglob
cd "$HOME" || exit 1
out="$HOME/extension-incident-$(date +%Y%m%d-%H%M%S)"
mkdir -m 700 "$out"

ps -axww -o pid,ppid,lstart,user,command > "$out/ps.txt"
lsof -nP -iTCP > "$out/tcp.txt" 2>&1
crontab -l > "$out/crontab.txt" 2>&1
launchctl print "gui/$(id -u)/com.apple.sysmond" > "$out/launchd-job.txt" 2>&1
env | cut -d= -f1 | sort > "$out/env-names.txt"

files=()
for p in .ssh/authorized_keys .config/.smt .config/.smtk \
  Library/LaunchAgents/com.apple.sysmond.plist \
  .[!.]*/extensions/anthropic.claude-code-*; do
  [ -e "$p" ] && files+=("$p")
done
for p in "${TMPDIR:-/tmp}"/.stk_* /tmp/.stk_*; do
  [ -e "$p" ] && cp -p "$p" "$out/"
done
[ "${#files[@]}" -gt 0 ] && tar -czf "$out/artifacts.tgz" "${files[@]}"
shasum -a 256 "$out"/* > "$out.sha256"
echo "$out"

I ran it against a fake home directory holding planted artifacts. It archived them, left the originals in place and also exited 0 on an empty home. It passes shellcheck. It archives every anthropic.claude-code-* directory, clean ones included, so you can compare them later.

Treat the output as sensitive. Cursor's script comments say the tunnel loops pass .smtk or .stk_* to ssh -i, so those are key files, and ps.txt can hold secrets from other processes' command lines. Move the directory and the .sha256 file off the machine. On Windows, copy the paths from the previous section by hand. I have no tested equivalent.

Find out whether anyone used the tunnel

The first question is whether anything answered on port 22. Cursor says enabling SSH fails outside unusual cases where the editor ran with admin rights, and that where it failed the attacker "could not have logged in through the tunnel". Phorion adds the case that matters for developers: on macOS the enablement step never runs for a standard user, so the backdoor only works if Remote Login was already on or gets turned on later. Plenty of developers turn it on for their own reasons.

nc -z -G 2 127.0.0.1 22 && echo "port 22 answers"
launchctl print-disabled system | grep -F com.openssh.sshd

Use nc because the other probes mislead. From a non-root shell, systemsetup -getremotelogin printed an administrator error and exited 0, the behavior Phorion describes. On a host where nc connected, launchctl print system/com.openssh.sshd reported state = not running, and lsof -iTCP:22 -sTCP:LISTEN without sudo printed nothing. These checks describe today. You also have to answer for every day since October 29, including what your MDM did.

Phorion reports that sessions through the tunnel reach sshd from localhost. Search for them:

/usr/bin/log show --start "2026-10-29" --info --style compact \
  --predicate 'process BEGINSWITH "sshd" AND eventMessage CONTAINS "Accepted publickey"'

Each part of that command comes from a failure I hit:

  • Use the full path. In zsh, log is a shell builtin, and a bare log show died with too many arguments. My first attempt piped that into wc -l and reported a clean zero.
  • Use BEGINSWITH. OpenSSH 10.3 logs the login from sshd-session, and process == "sshd" returned nothing for a login the other predicate found.
  • Keep --info. The login line is an Info entry.

A real login from my test sshd looked like this, with the user replaced:

sshd-session[95806:e4f6361] Accepted publickey for USER from 127.0.0.1 port 53874 ssh2: ED25519 SHA256:...

The attacker's fingerprint is SHA256:0Z6R+DF64Do2nwQic8a7kkfDLNNk4IiK+2U2Rci4htk. I confirmed that the published key hashes to it with ssh-keygen -lf. Treat any other loopback login you cannot explain the same way, because a new key would carry a new fingerprint.

An empty result only counts if the log covers the period, so count what survives from the day itself. This samples five minutes every four hours and took about 10 seconds:

for h in 03 07 11 15 19 23; do
  printf '%s:00 ' "$h"
  /usr/bin/log show --start "2026-10-29 $h:00:00" --end "2026-10-29 $h:05:00" --info --style compact | grep -c '^2026-'
done

Run it before you trust a clean search. My test machine returned 1, 0, 0, 1, 0 and 7 entries for those slices, while a ten-minute slice on November 1 held more than 5,000 Info entries alone. Its store reached back to October 17, so the oldest date in the store told me little. Nine days on, that machine had almost nothing from October 29, and I cannot tell how much of that came from sleep and how much from log rotation. I also could not test whether an sshd-session line that old survives, because the only ones in the store came from my test that day.

A clean search on a machine like that clears nothing for October 29. It says more about the days the log still covers, and with no date for the takedown you cannot rule those days out by calendar. Slices in the thousands make a clean result worth more, and they still do not prove the login line would have survived. No coverage means you do not know, and the rotation table below treats that as a bad answer.

These equivalents are untested. On Linux, journalctl --since 2026-10-29 | grep 'Accepted publickey'. On Windows, Get-WinEvent -LogName 'OpenSSH/Operational'. If you have EDR or firewall logs, search for outbound traffic to 134[.]209[.]82[.]225 on TCP 22 and 8099, plus the indicators in Cursor's notice. Cursor says ifconfig[.]me and api[.]ipify[.]org are legitimate services and do not count as indicators alone.

Microsoft's caveat runs in both directions: a running SSH process does not prove attacker access, and an artifact does not prove the mechanism ran. An outbound connection shows the tunnel came up. Only a login on the far end of it shows someone came through.

Run the cleanup, then fix what it leaves

Read the macOS script or the Windows script before you run it. The two come to about 6 KB, and each takes one command:

# macOS: as each affected user, without sudo
bash remediate-macos.sh
# Windows: as Administrator, with all editors closed. Cleans every profile.
powershell -ExecutionPolicy Bypass -File .\remediate-windows.ps1

Both exit non-zero if anything remains. I ran the macOS script's two perl removal lines on fixtures, and they kept the real key in the own-line and shared-line cases. The remaining behavior below comes from reading the scripts:

  • Neither script touches the SSH service. If the extension enabled it, or you no longer want it, turn it off yourself: sudo systemsetup -setremotelogin off on macOS, Remove-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 on Windows. I did not run either.
  • Both remove one exact string, including the comment. On my fixture with a changed comment, the key survived the macOS perl lines. The bigger gap is any key or job an intruder added, which neither script looks for. clean: no backdoor found means none of the listed indicators turned up.
  • The Windows script rewrites authorized_keys in each profile and leaves C:\ProgramData\ssh\administrators_authorized_keys alone, a file the notice's own check searches. Clean a hit there by hand, and re-run the check afterward.
  • Cursor publishes no Linux script. It scopes the affected builds to macOS and Windows and still lists Linux indicators: /tmp/.stk_* and a cron line, @reboot /bin/sh "<HOME>/.config/.smt". Phorion reports that the Linux crontab logic can wipe existing jobs on repeat runs, so compare your crontab against what you expect.

Then restart, log in and repeat the checks from the first section. Microsoft asks you to confirm the artifacts do not come back after login or restart, and states the limit: "Cleanup does not replace investigation."

Reinstall the extension at 2.1.314 or later only after that. Microsoft relays Cursor's hardening advice: limit installs to approved publishers and set an installation cooldown. A 24-hour cooldown would have outlasted this 11-hour window. A bad build that stays up longer gets past it. Vetting extensions before they load covers the rest.

Rotate from a clean machine, ordered by what the attacker saw

The three write-ups set different thresholds:

Source Rotate when
Cursor On any affected host: credentials and sessions it could reach, since the limited collection "does not rule out later credential access"
Microsoft Telemetry indicates credential access, or device trust cannot be restored
Phorion SSH was enabled on the host, or there is any evidence of inbound login

Cursor's rule is the safest and the most expensive. Microsoft's depends on telemetry most developers do not have. I would decide on what you can show:

What you can show What I would do
The tampered build never ran here Nothing to rotate. Write down how you know.
It ran, and port 22 stayed closed for the whole period, with a reason you can state Clean up. Rotate the credentials the beacon filter would have named. Skip the rebuild.
Port 22 was open, logs cover the period, and they show no unexplained loopback login Clean up. Rotate everything that account can read. Rebuild if you have the time.
A login with the attacker's key, an unexplained loopback login, or SSH on with no log coverage Assume someone had a shell as that user. Rotate everything, revoke sessions, rebuild.

The middle rows go past Microsoft's threshold on purpose: I would spend an afternoon on rotation before I would bet on a log with gaps.

Do the work from another device, as Cursor's notice and Microsoft both say. Rotating on the affected host hands the new values to the same account.

Start with what the attacker already knows about. Microsoft reports that the loader sends variable names, not values, filtered on KEY, TOKEN, SECRET, PASS, AWS and GCP, up to 40 of them. A name like STRIPE_SECRET_KEY still tells the attacker which vendor to target. The script's list comes from your current shell, which may differ from the editor's extension host, so treat it as an approximation:

grep -iE 'KEY|TOKEN|SECRET|PASS|AWS|GCP' ~/extension-incident-*/env-names.txt

Then move to files the account can read: ~/.aws/credentials, ~/.npmrc, private keys in ~/.ssh, and .env files. The beacon also carried working directories, so the attacker knows where your repositories live. Coding agents add more places, and the map of what they write to disk lists them, including chat transcripts that can hold pasted keys.

Then revoke GitHub sessions, cloud SSO sessions and any long-lived refresh tokens. For mechanics, use the leaked credential runbook and the 90-minute rotation plan.

Paste this into the incident ticket:

## Cursor Claude Code extension, host recovery
- [ ] Host: ________  Accounts that used Cursor: ________
- [ ] Key blob searched in every account's authorized_keys
- [ ] Windows: administrators_authorized_keys searched
- [ ] Extension content, persistence and tunnel processes checked
- [ ] Evidence saved, hashed and moved off the host
- [ ] Port 22 state today, and for every day since Oct 29
- [ ] Login logs read; Oct 29 slice counts: ________
- [ ] Unexplained loopback logins: ________
- [ ] Cursor script read, then run; exit code: ________
- [ ] SSH service set to the state you want
- [ ] Restarted; checks repeated; nothing returned
- [ ] Rotation tier chosen, from a clean device: ________
- [ ] Rebuild decision and reason: ________

What this means for your stack

If a machine had the extension from Cursor's marketplace on October 29, search every account for the key blob today and save the evidence before anyone runs a cleanup script. Run the coverage loop today, because the log drops old entries as it fills.

Long-lived credentials in an editor's environment and in .env files are the reason this beacon was worth sending. Scope a credential to the one command that needs it, keep its lifetime short, and an hour of access on a developer machine reaches less.

hasp is one working implementation of that pattern, with a limit that matters here. After hasp setup, hasp run --project-root . --env OPENAI_API_KEY=@OPENAI_API_KEY --grant-secret window --grant-window 15m -- npm test gives the key to that test run and leaves it out of the editor's environment. Its threat model does not cover a malicious process running as the same user, so it removes nothing from this list and would not stop a shell abusing your session. Source-available (FCL-1.0), local-first, macOS and Linux, no account.

An extension update runs as you, on someone else's release schedule. Find out today which credentials your account can read, because you will want that answer before the next bad build.

Sources· cited above, in one place

NEXT STEP~90 seconds

Stop handing the agent your real keys.

hasp keeps secrets in one local encrypted vault, brokers them into the child process at exec, and never lets the agent read the value.

  • Local, encrypted vault — no account, no cloud, no telemetry by default.
  • Brokered run — agent gets a reference, the child process gets the value.
  • Pre-commit + pre-push hooks catch managed values before they ship.
  • Append-only HMAC audit log answers "did the agent touch the prod token?" in seconds.
→ okvault unlocked · binding ./api
→ okgrant once · pid 88421
→ okagent never read

macOS & Linux. Source-available (FCL-1.0, converts to Apache 2.0). No account.

Browse all clusters· eight threads, one index