A public GitHub issue could steer an agent into leaking private repositories
Researchers showed that instructions planted in a public issue could make an agent using GitHub’s MCP server copy private repository data into a public pull request.
By the NoFly team
github.list_issues(repo: "acme/public-site")- Agent
- Claude Desktop
- Came from
- Issue #42 on a public repository
- Rule
- Instruction hidden in a tool result
- Why
- The issue tells the agent to read private repositories and publish what it finds.
What happened
Invariant Labs published the attack on 26 May 2025. The attacker opens an issue with hidden instructions on a public repository the victim works on.
The victim asks their agent, connected to GitHub’s MCP server with access to private repositories, to look at the open issues. The agent reads the planted issue, follows it, collects information from the private repositories and opens a pull request in the public one. In the researchers’ demonstration with Claude Desktop, the leak included a private repository’s name, a relocation plan and a salary.
- 01
An issue with hidden instructions is opened on a public repository.
- 02
The victim asks the agent to review open issues.
- 03
The agent reads private repositories as the issue tells it to.
- 04
It publishes what it found in a public pull request.
Why it worked
Probable cause
One agent session held a token that could read private repositories and write to public ones, and nothing limited data flowing from one to the other. Invariant said no server-side patch could fix it.
How NoFly stops it
Protect
The MCP gateway screens every tool result, so an instruction inside an issue is caught on its way back from GitHub. Each agent’s allow-list can also keep a public-repository task away from private repositories.
Explain
If the agent acts anyway, the verdict names the issue that caused it: take the issue away and the private repositories are never read.
Attack
Attack simulation plants instructions in tool results and replays them against your own agents, so you see whether this path holds before someone else does.
What to do this week
- Give agents one repository per session where the task allows it.
- Use fine-grained tokens that cannot read private repositories for work on public ones.
- Treat issue and pull request text as untrusted input to every agent.
More from the blog.
Find out what your AI is allowed to do today.
Book a call and we will map your agents, MCP servers and keys with you, or start on one laptop with the free scan.