Case Studies

Backdoored Claude Code Extension Exposes Agent Risk

A Claude Code extension distributed through Cursor Marketplace was found to contain backdoor code. The incident highlights how AI coding agents can become high-privilege gateways to source code, developer credentials, terminals, and cloud infrastructure.

Font size

A VS Code extension using the Claude Code name was reported to contain backdoor code when listed on Cursor Marketplace. The danger goes beyond the malicious code itself: AI coding tools may have simultaneous access to source code, terminals, Git credentials, and cloud environments.

Public analysis points to third-party extension distribution as the point of entry. Cursor has issued a security advisory, but the affected versions, installation count, and scope of any data exfiltration have not yet been fully confirmed.

Claude Code Extension Backdoor: The High-Privilege Trap in AI Coding Tools

A VS Code extension using the Claude Code name was reported to contain backdoor code on Cursor Marketplace.

The most alarming aspect of this incident is not simply that an extension turned out to be malicious. It shows that AI coding agents are no longer just code-completion tools. They can read a codebase, execute commands, and access Git and cloud credentials. Once the extension distribution chain is compromised, attackers may gain more than a routine file upload: they may obtain a path between a developer’s machine and an organization’s cloud resources.

Phorion’s analysis indicates that the risk arose through third-party distribution on Cursor Marketplace. DoublePulsar says the payload could execute malicious code on developer devices for remote control or sensitive-data theft. Cursor has published a security advisory for the Claude Code extension, indicating that the incident is now under official response.

Several key details remain unconfirmed, including the affected versions, actual installation numbers, the identity of the attackers, and the extent of the intrusion. The available information demonstrates a plausible attack path, but it does not support the claim that every developer who installed the extension was compromised.

The Backdoor Entered Through Distribution

The entry point was not the Claude model itself, but the VS Code extension supply chain.

According to Phorion’s original analysis, the issue affected the Claude Code for VS Code extension offered through Cursor Marketplace. Attackers distributed a backdoored extension package through a third-party marketplace, relying on developers’ trust in the Marketplace and an official-looking brand to prompt installation.

Two concepts need to be separated here:

  • An extension named “Claude Code” does not necessarily mean its code is maintained by Anthropic.
  • Its presence on Cursor Marketplace does not mean Cursor has conducted a full security review or endorsed the extension’s code.

Once VS Code allows an extension to run, it may operate within the permissions available to the editor process. Its actual capabilities depend on the permissions requested by the extension, the host configuration, and the authorizations granted by the user. DoublePulsar’s analysis indicates that the payload could execute malicious code for remote control or sensitive-data theft.

The disclosure reached the front page of Hacker News, earning 230 points and 328 comments. One reason for the intense discussion is that developers install extensions every day. Another is that many of today’s extensions are not merely syntax-highlighting utilities; they are Agent extensions capable of modifying code and running tests.

Common targets for malicious extensions include browser data, configuration files, and the installation of additional software. The potential targets for a Claude Code-style extension are broader because it is designed to work with repositories, terminals, and development workflows.

The distribution layer was only the beginning. The actual damage depends on what the backdoored extension could access after installation.

AI Coding Tools Have Become High-Privilege Entry Points

Traditional VS Code extensions usually declare and request specific API permissions. Access to workspace files, terminal access, and network requests can generally be seen in an extension’s manifest.

AI coding agents change the risk model. Tools such as Claude Code offer cross-file understanding, code modification, command execution, and assistance with Git operations. To perform those tasks, they often need a combination of capabilities:

  • Reading an entire code repository;
  • Running tests, builds, and scripts in a terminal;
  • Reading Git configuration, remote addresses, and commit history;
  • Using Git, cloud platform, or API credentials stored in environment variables;
  • Continuously calling a model and taking actions based on task content.

These capabilities do not necessarily come from the extension itself. Many credentials are already present in the user’s shell, SSH agent, cloud CLI, and password manager. An Agent only needs to issue the right command at the right moment to reach those resources indirectly.

A single compromised component can therefore escalate from a malicious extension into a compromised developer machine and cloud environment. Attackers do not need to break into every system individually. They can read CI configuration in a repository and search for deployment tokens, inspect shell history for infrastructure commonly used by the developer, or modify build scripts so malicious code runs during testing or release.

This is the fundamental difference between Agents and traditional code-completion tools. When a completion tool writes incorrect code, developers will usually see the mistake. When an Agent executes the wrong command, the error may already have been written to the workspace, committed to Git, or triggered a deployment.

The greater the privileges, the shorter the feedback loop for mistakes and attacks.

Official Channels Do Not Prevent Third-Party Distribution

There is an easily confused chain of responsibility among Anthropic, Cursor, and the Marketplace.

Anthropic provides the Claude Code product. Cursor operates the editor and its Marketplace. The presence of an extension named “Claude Code for VS Code” on Cursor Marketplace does not automatically establish a publishing relationship with Anthropic.

Users, however, see familiar names: Claude, Code, and VS Code. Combined with Cursor’s marketplace placement, the trust conveyed by those brands and platforms can outweigh checks of the publisher’s identity, code differences, and package signatures.

This does not mean official channels are inherently unsafe. The issue is a mismatch among official branding, third-party packaging, marketplace distribution, and local execution. Brand endorsement answers who made the product; code security requires knowing exactly what is inside the binary.

Anthropic’s official distribution channels also warrant separate verification. Developers should distinguish installation commands listed in official documentation, extensions released from official GitHub repositories, and similarly named packages in third-party Marketplaces. They should not rely on an extension title or a logo on an installation page alone.

Cursor’s security advisory is a necessary first step, but the response should cover more: removing malicious versions, notifying affected users, publishing affected versions and hashes, providing a clean version for comparison, and recommending credential rotation.

A supply-chain attack cannot end with simply deleting the bad package. Machines that already installed it may remain exposed.

How Developers Should Verify Extensions

There is no universal command for verifying an extension. The process should cover three stages: before installation, during installation, and after installation.

1. Pin Extension Versions and Disable Automatic Marketplace Updates

Teams can standardize extension versions and distribution sources so that individual machines do not automatically receive an unreviewed package. For high-privilege tools such as Claude Code, a safer approach is to validate a fixed version internally and distribute it across the team.

Before reviewing a new version, determine which files changed from the previous release:

code --list-extensions --show-versions

VS Code extensions are usually installed in the user directory or the system extensions directory. The exact path depends on the platform and installation method. Developers can copy it from the extension’s details page in VS Code rather than guessing.

2. Verify the Publisher and Package

At minimum, check four items:

  • The extension identifier, rather than only its display name;
  • The publisher account and whether it matches the source listed in official documentation;
  • The package hash or a published checksum;
  • The repository URL, recent commit history, and publisher signature.

If an extension claims to come from Anthropic, look up its extension ID through Anthropic’s official documentation or official repository. A Marketplace page should not be the starting point for identity verification.

On macOS or Linux, calculate a digest for the downloaded package:

shasum -a 256 claude-code.vsix

On Windows PowerShell, run:

Get-FileHash -Algorithm SHA256 .\claude-code.vsix

A digest only proves that a file matches a known value. It does not prove the code is safe, but it can help teams detect replaced files, unusual publishing activity, or inconsistent distribution nodes.

3. Review Permissions and Actual Behavior

Do not rely solely on the permissions listed on an extension’s page. Also inspect package.json, bundled scripts, network request destinations, and command-execution code.

Focus on the following behaviors:

rg -n "child_process|exec\(|spawn\(|https?://|process\.env|homedir|\.ssh|\.git" package.json extension.js

This command is only a quick way to locate entry points, not a complete security audit. Minified bundles, dynamically downloaded scripts, and obfuscated code still require manual review. For an extension that can execute commands, I would also review its publishing history, build artifacts, and CI publishing workflow.

4. Isolate Source Code, Cloud Credentials, and the Agent Execution Environment

Long-lived credentials on a developer machine should not all be exposed to an Agent.

Practical measures include:

  • Using dedicated roles for cloud accounts and granting only the permissions required for the current repository;
  • Using short-lived tokens instead of placing long-term access keys in .env files or shell configuration;
  • Running tests and builds inside containers or virtual machines;
  • Denying access to ~/.ssh, cloud CLI configuration, and production environments by default;
  • Requiring human approval for high-risk commands and recording every invocation.

Production secrets should not be stored in the repository either. GitHub secret scanning can detect some exposures, but it cannot replace permission isolation.

A simple principle applies: give the Agent only what it needs, and revoke access when the task is complete. A one-time need for administrator privileges does not justify leaving those privileges available across the entire machine.

Vendors Need to Define Permission Boundaries for Agents

Vendors cannot solve the problem merely by checking the code an AI produces. They need to design for how to contain damage after a compromise.

Least Privilege

Code suggestions, code modifications, test execution, and production access should be separate privilege levels. An Agent assigned to run tests should not simultaneously have permission to deploy to production.

Short-Lived Credentials

Platforms such as GitHub, AWS, Azure, and Google Cloud can issue short-lived credentials. Credentials should also be scoped to a repository, branch, time window, and set of permitted actions to limit opportunities for lateral movement.

Sandboxing and Network Controls

Command execution should run in a container, remote development environment, or dedicated sandbox. Unrelated network egress should be disabled by default. Otherwise, a malicious payload can send data directly to an external server.

Audit Logs

Logs should record at least:

  • Which files the Agent requested;
  • Which commands it executed;
  • Which files it modified;
  • Which credentials it used;
  • Which user or extension initiated each action.

Logs should not be stored only on the local machine. Otherwise, an attacker with local access can delete them too.

Revocable Authorization

Users should be able to terminate a session, revoke OAuth tokens, rotate credentials, and disable the relevant extension with a single action. Remote execution environments should support destruction, not merely removal from a list.

The security goal is not to make Agents incapable of making mistakes; that is unrealistic. The goal is to ensure that one mistake, malicious extension, or mistaken model decision causes limited damage and cannot become a pathway to an entire developer machine and all of its cloud resources.

Editorial Perspective

This incident matters because it goes beyond another poisoned VS Code extension. It exposes the real cost of the Agent permission model. When a code-completion tool makes an error, developers can still inspect the output line by line. When an Agent can read and write repositories, execute commands, and call cloud APIs, mistakes become system events.

My assessment is that the first widely adopted Agent security capabilities will not be systems that detect all malicious code. They will be fine-grained authorization, short-lived credentials, command approval, and comprehensive auditing. The market will shift from asking how much an Agent can do to asking how much access can be revoked when something goes wrong.

This is not entirely like previous npm dependency-poisoning incidents. An extension can still impersonate a legitimate tool, but Claude Code-style Agents connect source code, credentials, and execution environments, placing the backdoor close to the core of the development workflow. The immediate change is that the risk has moved from an ordinary editor plugin to a high-privilege Agent entry point. Cursor has also issued a security advisory. However, the range of affected versions, the attackers’ identities, and actual data exfiltration remain uncertain, so the public analysis should not be treated as a complete incident report.

Source: https://phorion.io/blog/offical-claude-code-vsx-compromise/