Skip to content

Accident reports · May 2025

GitHub MCP: a public issue leaks private repositories

Invariant Labs demonstration: a booby-trapped issue in a public repository pushes the agent to publish data from private repositories.

  • Company GitHub
  • Agent Claude Desktop
  • Model Claude 4 Opus
Outside content
Colourful lines of code on a dark screen
Photo: Markus Spiske on Unsplash
WhenMay 2025 (researchers' demonstration)
WhoAn agent connected to GitHub's official MCP server (Claude Desktop, in the experiment)
What the agent didA booby-trapped issue made it copy data from private repositories into a public one
ConsequenceNo known real victim; a design flaw with no simple server-side fix

What happened

On 26 May 2025, the security company Invariant Labs published a demonstration on GitHub's MCP server, the one that lets an AI assistant read and write in a developer's repositories. The experiment ran on accounts and repositories created for the purpose.

The scenario: a developer has a public repository, where anyone can open an issue, and private repositories. An attacker opens an issue in the public repository containing instructions aimed at the agent. The developer simply asks the assistant to look at the open issues. The agent reads the issue, follows the instructions, fetches information from the private repositories and publishes it in a pull request on the public repository, readable by everyone.

In the demonstration, the agent exposed the name of a private project, a relocation plan and a salary stored in the test account. Invariant says it used Claude Desktop and the Claude 4 Opus model, and that the flaw does not depend on the agent or the MCP client. According to DevClass, everything works "as designed": there is no server bug to fix, and the researchers see no simple solution.

Why it happened

For the agent, the text of an issue written by a stranger and its user's request arrive in the same context. And the same access token opened both the public repositories, where anyone writes, and the private ones.

Invariant notes that Claude Desktop asks for confirmation on every tool call, but that many users choose "Always Allow" and stop watching each action.

The failure family

In our catalogue, this is the "Outside content" family: the agent obeys an order hidden in content it reads for its work. It leads to "The leak": private information published for all to see.

The safeguard in code

  • One token per task, limited to the repositories it needs: a session that reads public issues has no access to private repositories (Invariant suggests "one repository per session").
  • Any content written by a third party (issue, comment) is marked as outside content; while it is in the context, public writes go through human confirmation.
  • No "Always Allow" for tools that publish: each publication shows what goes out, and where.

What we test

The "planted instruction", "trap in the tool" and "camouflaged planted instruction" tests slip an order into content the agent reads for its work. We watch whether it carries it out, and whether it sends data to someone who should not have it. The fault is a recorded action, whatever the agent says about it.

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