Rightshold™ Sign up

Answers · agent safety

How do I rotate API keys and tokens after installing a malicious VS Code or Cursor extension?

Last updated

TL;DR: Clean the machine first, then rotate from a different, trusted computer, then confirm the old credentials are dead. An extension runs with the editor's own permissions: VS Code's docs say the extension host can do anything VS Code can, including reading and writing files, making network requests and running processes. So treat every secret that user account could read as exposed, not only the ones the extension is known to have taken. Cursor's October 29, 2026 notice about a tampered Anthropic.claude-code 2.1.313 in its marketplace is a good example. The payload collected environment variable names (not their values), added an attacker SSH key labeled svc-telemetry and installed persistence that keeps running after you uninstall the extension. Cursor's advice ends with: rotate credentials and sessions reachable from the host, from a trusted system. Work through the credential stores on that machine, revoke rather than just replace, and check each provider's last-used data for activity you don't recognize.

What should I check, step by step?

1. Check for the incident's known artifacts first. For the Cursor case, look for svc-telemetry in ~/.ssh/authorized_keys, and on Windows also in C:\ProgramData\ssh\administrators_authorized_keys. Then run the publisher's remediation script or rebuild the machine. Uninstalling the extension may not remove the persistence.

  1. Isolate the machine, and do the rotation from a different computer you trust. A backdoor that is still running would see the new secrets you type or paste.
  2. List every credential the affected user account could read: ~/.ssh private keys, cloud CLI credential files (~/.aws, gcloud, Azure), ~/.npmrc and other registry tokens, the GitHub CLI and git credential helper, .env files in every workspace you opened, tokens in MCP client configs, and signed-in browser sessions.
  3. Revoke, don't only replace. A new key does nothing while the old one still works. On GitHub, revoking an OAuth app or GitHub App authorization also revokes the tokens issued under it, and a revoked token can't be restored.
  4. For AWS IAM user keys, create the new key, move your tools to it, then set the old key to Inactive and delete it. AWS's routine procedure suggests waiting days before deleting. After a compromise, deactivate at once and use get-access-key-last-used to see whether the old key was used.
  5. For npm, run npm token list, then npm token delete <id> for each token (the id, not the truncated token). npm warns that revocation can take up to an hour.
  6. Remove SSH public keys that machine used from GitHub, servers and other services, and make new key pairs on the clean machine.
  7. Sign out other sessions and review security logs, such as GitHub's security log (oauth_authorization.destroy marks a revoked token) and your cloud provider's audit trail, for the time the extension was installed.

What the Cursor notice says (Oct 29, 2026)

Cursor says a maliciously modified Anthropic.claude-code 2.1.313, not developed by Anthropic, was in the Cursor VS Code extension Marketplace from about 2:27 AM to 1:35 PM PT on October 29, 2026 (5:27 AM to 4:35 PM ET), and that at most 5,000 users were affected.

Order matters

Rotating first and cleaning later hands the new secrets to whatever is still running. Clean or rebuild the machine, rotate from a trusted machine, and only then put the new secrets on the cleaned one.

How do I ask Rightshold about this (free, no key)?

Add the MCP server https://www.rightshold.com/mcp to Claude, Cursor, ChatGPT, Grok or VS Code, then ask: “A Rightshold API key may have been on a machine that ran a malicious editor extension. Freeze spending, listings and new work on my account while I rotate the key.”

One-click setup

{
  "tool": "account_controls",
  "arguments": {
    "action": "freeze",
    "reason": "API key may have been exposed on a host that ran a malicious editor extension"
  }
}

Rightshold can freeze and rotate only Rightshold API keys. It doesn't scan your machine, see your other credentials or revoke them for you. Not legal advice.

What are the sources?

Related

Not legal advice. JSON · Markdown · All answers

Get a free API key in one call

No card and no email needed. 100 free credits; the license and policy checks stay free without a key.

curl -s -X POST https://www.rightshold.com/v1/accounts/signup -H "Content-Type: application/json" -d '{"accept_terms":true}'
export RIGHTSHOLD_API_KEY=rs_...   # the api_key from the reply (shown once)
curl -s https://www.rightshold.com/v1/licenses/check -H "Authorization: Bearer $RIGHTSHOLD_API_KEY" \
  -H "Content-Type: application/json" -d '{"license":"MIT","intended_use":{"commercial_use":true}}'