Agent incident database
GitHub MCP: a public issue made an agent leak private repositories
26 May 2025GitHub · GitHub MCP serverdata exfiltrationdisclosed vulnerability
Invariant Labs showed that a malicious issue posted in a public GitHub repository could hijack an AI agent connected through GitHub's MCP server. The agent then copied information from the user's private repositories into a public pull request.
How it unfolded
Each step on its own looked like ordinary agent work. The harm came from the sequence.
- 1
Read open issues in a public repository, including one written by an attacker
- 2
Model followed the instructions hidden in the issue
- 3
Read contents of the user's private repositories
- 4
Opened a pull request in the public repository containing the private data
harm
Which policy would have stopped this?
In our reading of the reports, these policies from the open library stop the harmful step before it runs.
- External content taint: high-impact actions require a fresh gate: The instructions came from a public issue. After reading it, the agent's next high-impact step, a pull request in a public repository, needs a fresh approval.
Open External content taint: high-impact actions require a fresh gate in the playground and build the path yourself.
This is our reading of public reporting. We haven't run it against the original systems.
What happened
Invariant Labs published the attack on 26 May 2025, using Claude Desktop with the official GitHub MCP server and Claude 4 Opus. An attacker files an issue containing a prompt injection in a public repository. When the user asks the agent to look at that repository's open issues, the agent reads the malicious issue and follows its instructions. It pulls data from the user's private repositories into its context and then opens a pull request in the public repository containing that data, where the attacker can read it. In the demo the leaked information included a private project name, relocation plans and salary details.
Outcome
Invariant described it as an architectural problem rather than a bug in the server's code, with no simple server-side fix, and recommended per-session repository restrictions and least-privilege tokens. DevClass reported no official GitHub statement.
Sources
- GitHub MCP Exploited: Accessing private repositories via MCP, Invariant Labs, 2025-05-26
- Researchers warn of prompt injection vulnerability in GitHub MCP with no obvious fix, DevClass, 2025-05-27
A summary of public reporting. The step-by-step timeline is our reading of those sources; where they differ, we say so above.
Your agents
Could this happen to yours?
For developers
Build a path yourself
Recreate a sequence in the playground and see how policies treat it.