Incident report

Official GitHub MCP Server Private Repository Exfiltration via Toxic Agent Flow

On May 26, 2025, Invariant Labs disclosed a critical cross-repository exfiltration attack against the official GitHub MCP server dubbed a Toxic Agent Flow. An attacker could plant hidden indirect prompt injection instructions inside an issue on any public repository maintained by a developer. When the developer asked an MCP-connected assistant such as Claude Desktop to review open issues, the agent followed the injected directive using the developer's over-scoped GitHub PAT to read private corporate repositories and publish stolen code and secrets into a public pull request. The disclosure drove industry adoption of fine-grained per-repository MCP tokens and runtime policy guards blocking cross-boundary data flows.

Incident record

Reported
Severity
Critical
Vector
Indirect Prompt Injection
Affected system type
MCP-Connected Developer Agents & Repository Integrations
Reference URI
https://www.invariantlabs.ai/blog/github-mcp-exploited-accessing-private-repositories-via-mcp

Inspect in Interactive Incidents Hub

Defensive lesson

Scope MCP GitHub tokens to individual repositories, separate untrusted public issue triage from private repo read privileges, and gate public write tool calls.

Research citation

Referenced techniques