Skip to content

Accident reports · February 2026

Claude Code: opening a booby-trapped repository was enough to run commands and steal the API key

Check Point Research demonstration: settings files brought by a repository acted before the trust question. Three flaws fixed by Anthropic before publication.

  • Company Anthropic
  • Agent Claude Code
  • Model not published
Outside content
A small white and gold rocking horse on pale fur
Photo: Kristof Zerbe on Unsplash
WhenFlaws reported between July and October 2025, fixed between August 2025 and January 2026; demonstration published on 25 February 2026
WhoClaude Code, Anthropic's coding agent, tested by two Check Point Research researchers, Aviv Donenfeld and Oded Vanunu
What the agent didIn the demonstration, opening a booby-trapped repository was enough: its settings files ran commands or sent the API key elsewhere, before the "do you trust this folder?" question
ConsequenceNo real attack reported; three flaws fixed by Anthropic before publication

What happened

This is a researchers' demonstration, not an observed attack. Check Point's researchers looked at what happens when a developer clones an unknown code repository and starts Claude Code in it. A repository can bring its own settings files, in a .claude folder and a .mcp.json file.

They found three paths. One: a command declared "at startup" in the repository's settings ran without the usual approval. Two (CVE-2025-59536, scored 8.7 out of 10 according to The Hacker News): a repository setting could pre-approve MCP servers, which started before the user had read the trust question. Three (CVE-2026-21852, scored 5.3): a setting changed the address Claude Code sends its requests to. The first requests, carrying the user's API key, went to the attacker before the trust question.

According to the researchers, a key stolen this way could also open the team workspace's shared files. The flaws were reported to Anthropic between July and October 2025 and fixed between August 2025 and January 2026 (versions 1.0.87, 1.0.111 and 2.0.65 according to The Hacker News). Anthropic added a warning for settings that come from a repository, stopped MCP servers from starting before approval, and held back all network traffic until the user answers.

Why it happened

A settings file is not text you read: it is an order the tool carries out. Here, a file written by a stranger was treated as if it came from the user. And the trust question came too late: some actions had already happened when it showed up.

The failure family

In our catalogue, this is the "Outside content" family: something from outside, here the cloned repository, takes control of what the agent does.

The safeguard in code

  • Nothing an unknown folder brings (commands, servers, API address) runs before the user's explicit approval.
  • The address API keys are sent to is set by the user or the company, never by a project file.
  • Keep the coding agent up to date, and open unknown repositories in a throwaway environment, with no production key.

What we test

Here, the model decides nothing: the tool reads the settings and applies them. A coding agent opened in a repository that brings its own startup commands, MCP servers or another API address is not yet tested as such; we are adding it to our list. What a company can lock down today: forbid repositories from changing the agent's settings without review, and never leave a production key on a machine that opens unknown code.

And your agent, what would it do?

The crash test puts your agent in these situations, dozens of times, on several models. You get the figures, the conversations where it gave in, and the fix plan.

Crash-test my agent See the live demo

Further reading