Details may change as reporting changes. Information comes from the linked sources, and we do not guarantee it is complete or current.
In plain English
MCP is a standard way of plugging tools into an AI assistant. With a GitHub connection, your assistant can read your projects and open pull requests for you.
Researchers at Invariant Labs showed a simple trap. An attacker posts a normal-looking note on a public project. It contains hidden instructions. Later you ask your AI assistant to "look at the open notes." It reads the trap, follows it, pulls information from your private projects, and posts it in a public place.
Invariant stressed that this is not a bug in GitHub's server code. It is a design problem: the assistant can read untrusted text, can reach private data, and can post publicly. Put those three together and a stranger can steer it.
Words used here
- MCP
- A standard way to connect tools and data to an AI assistant.
- Issue
- A public message on a code project, like a bug report anyone can post.
- Private repository
- A code project only you and your team can see.
What happened
Invariant Labs reported (May 26, 2025) that an attacker could hijack a user's agent through a malicious GitHub issue and coerce it into leaking data from private repositories.
The trick works if you have connected the GitHub connector to an AI assistant and have both a public project (where anyone can leave notes) and a private one.
Invariant said this is not a bug in the GitHub connector itself but a basic design problem, and that it affects any AI helper that uses it, whichever AI model is behind it.
Its main recommendation: limit the agent's access to only the repositories it needs, following least privilege.
How it unfolded
- May 26, 2025
Invariant Labs publishes its findings.
Who was affected
People who connect an AI assistant to GitHub with broad access to both public and private repositories.
What the response was
- Invariant published the finding and mitigation advice.
- Industry commentary stressed limiting agent permissions rather than waiting for a patch.
What went wrong
- The agent could read untrusted text, reach private data and publish publicly, all in one session.
- Access was granted per account, not per task.
What worked
- The research gave the industry a clear, reproducible example and a clear fix: smaller permissions.
What a small team should do differently
- Give agents access only to the repositories they need.
- Do not let an agent that reads outside text also publish publicly without approval.
- Review what an agent plans to do before it does it.
What you can do today
- Open GitHub > Settings > Applications and check which tools can access your private repositories.
- Replace broad personal access tokens with narrowly scoped ones for each tool.
- Turn on human approval in your AI client for any action that writes or publishes.
Official help for the platforms involved
The lesson to take away
The risky combination is untrusted input, private data and a way to send it out. Break any one of the three.
Sources
- Invariant Labs: GitHub MCP ExploitedInvariant Labs, May 26, 2025
Finished this one?
Add it to What I learned and earn 40 Trust. You can open your list from the badge at the bottom of the page.