Skip to the content
AI and Cybersecurity Learning and Practice Center Test automation Open the Learning Center

IncidentMCP servers and tools

GitHub MCP: a malicious issue makes an agent leak private repositories

HighGitHub

Anyone who could open an issue on a public repository could trick a developer's AI agent into copying data from their private repositories into a public pull request. The flaw was in how agents combine tools and permissions, not in the server's code.

Replay the attack step by step in the Learning Center

How it happened

  1. The attacker files an issue with instructions for an AI agent in the victim's public repository.
  2. The victim's agent has access to private repositories too, and is asked to look at open issues.
  3. The agent follows the malicious issue and reads data from private repositories.
  4. It publishes the data in a public pull request; many users had set tool calls to always allow.

Impact

Anything the agent could read in private repositories could leak.

The fix

No server patch could fix the design; GitHub later added a lockdown mode that only surfaces content from collaborators with push access.

Lessons

  • Use narrowly scoped tokens, ideally one repository per session.
  • Never 'always allow' an agent that reads public content and can write somewhere public.
  • Enforce data-flow rules, such as private data never going to public places.

Sources