
GitHub MCP: Public Issue to Private Repo
Day 18 showed a control turning into a weapon. Today shows a boundary that was never enforced at all. The GitHub MCP incident is the cross boundary classic of agent security, and it is the case this series has cited more than any other, since Day 1, because a single public issue reached into private repositories and exfiltrated their contents. No exploit in the traditional sense. Someone filed an issue.
We take it apart fully today because it unites three threads from the series into one clean story: indirect injection delivery from Day 15, the confused deputy and broad token from Day 11, and the trust boundary that moved from Day 1. If Day 13’s postmark-mcp was the supply chain archetype, this is the trust boundary archetype.
Same boundary as the other case studies: this is drawn from public disclosure, explained at the level of mechanism and defense. The pattern has been widely discussed and mitigations exist. The understanding is the artifact.
The setup
A developer connects a GitHub MCP server to their coding agent. Entirely reasonable, it is one of the most useful integrations there is. The agent can now read issues, read and write code, open pull requests, all through the server. To do this the server holds a GitHub token.
Here is the quiet decision that made the incident possible. That token had broad access, spanning the user’s repositories, both public and private. One credential, one scope, covering everything the user could reach. This is the shared broad token from Day 6 and Day 11, in a coding context. The agent, through that token, could touch any repo the developer could.
The developer also, naturally, has public repositories. Open source projects where anyone on the internet can file an issue. That is the whole point of public issues, they are an open channel for strangers to communicate with the project.
Put those two facts together and the boundary problem is already visible. The agent reads from a fully public, anyone can write channel, and it holds a token that reaches fully private repos. Nothing sits between those two facts except the agent’s judgment, and the agent’s judgment is steerable by the text it reads.
The attack, step by step
Conceptually, no operational detail needed because the shape is the lesson.
The attacker files a public issue. On the developer’s open source repo, anyone can do this. The issue body contains buried instructions, framed as described on Day 16 to read as something the agent should act on. This is the Day 15 delivery vector, a public issue, which is a reads anyway channel, the agent processes issues as its job.
The developer asks the agent to work on issues. A completely normal request. Triage the open issues, summarize them, help me address them. The agent calls the GitHub MCP server to read the issues, including the malicious one.
The injection lands. The buried instructions enter context at the ingest stage. They direct the agent to go look at the developer’s private repositories, pull specific content, and place it somewhere the attacker can see, for example by writing it into a pull request or a comment on the public repo.
The broad token does the rest. The agent, now acting on the injected instruction, reaches into the private repos. It can, because the token spans them. It reads private content and writes it out through the public repo. The attacker reads it there.
The data crossed from private to public. The boundary that should have stopped it, private repos are not readable by this public interaction, was never actually enforced, because the single broad token made no distinction between the public context the agent was working in and the private repos it could reach.
Why no traditional vulnerability was needed
This is the part worth sitting with, because it is the whole reason the series exists.
No authentication was broken. The token was valid and used as issued. No bug in GitHub was exploited. No bug in the MCP server code, in the Day 14 command injection sense, was required. Every component did exactly what it was built to do. The server read issues because that is its function. The token accessed private repos because that is its scope. The agent followed instructions because that is what agents do.
The compromise emerged from the combination, not from any single defective part. This is the Day 1 thesis in its purest form: the vulnerability is not in any single system, it is in the trust boundary between them. There was no boundary between the public issue and the private repo except an agent that reads its instructions from whatever it is given.
The trifecta, perfectly complete
Map it and every condition is satisfied by a different component, the Day 4 pattern at its cleanest.
- Condition B, untrusted input: the public issue. Anyone on earth can write it.
- Condition A, valuable data: the private repositories. Reached via the broad token.
- Condition C, outbound channel: the public pull request or comment. Writes data back to where the attacker watches.
Three separate components, bridged by one agent holding one over scoped token. The injection supplies the intent, the token supplies the reach, the public write supplies the exit. If any one of the three had been constrained, the chain breaks. That is the hopeful part, and it is where defense lives.
Reproduce the shape in your lab
Do not touch GitHub. Rebuild the boundary crossing locally with your Day 17 toy coding agent.
- Create two local repos in your sandbox: one public, meaning the agent treats its issues as untrusted outside input, and one private, holding a secret file.
- Give the agent one capability set that spans both, the broad token analogue. A single read and write ability over both repos.
- Plant an injection in the public repo’s issue content directing the agent to read the private repo’s secret and write it into the public repo.
- Ask the agent to work on the public repo’s issues. Observe whether the secret crosses from private to public.
- Now fix it with scope: give the agent, when working in the public context, access only to the public repo. Re run and confirm the private read is refused. The injection still lands, the boundary now holds.
Steps 4 and 5 are the entire incident and its fix, in a box you own. Same attack, broad scope leaks, bound scope does not.
Detection and defense, the honest version
Ordered by effectiveness, and notice this is the Day 11 lesson applied to a boundary.
Scope the token to the context, not the user. The core fix. When the agent is working in or from an untrusted public context, it should hold access only to that context, not to everything the user can reach. The private repos should be out of scope for a session driven by public input. This directly breaks condition A’s reach and is the single highest value change.
Separate untrusted work from privileged access. Processing public issues should happen in a mode or session that structurally cannot touch private repos, the week four isolation idea. If reading public input and reaching private data can never co occur in one privileged context, the bridge cannot form.
Constrain the write channel. Condition C. The agent should not freely write agent generated content from a private source into a public destination. Flag or gate cross context writes, private data appearing in a public PR is exactly the signal to catch.
Human review on cross boundary actions. Not on volume, on consequence, the Day 18 refinement. An action that moves data from a private repo into a public one is precisely the kind that warrants a human look, while routine same context edits do not.
Egress and cross context monitoring. The backstop. Private content appearing in public artifacts is detectable after the fact and should alarm, the Day 9 and 13 principle pointed at repo boundaries.
The thesis, proven again by the archetype: there was no boundary, only an agent and an over scoped token. You restore the boundary not by making the agent smarter about which instructions to trust, that fails, but by ensuring the token in an untrusted context simply cannot reach the private side. Make the reach match the trust of the context, and the cross boundary chain cannot complete.
Homework for Day 19
- Rebuild the two repo boundary crossing in your sandbox: public with untrusted issues, private with a secret, one capability set spanning both.
- Land the injection and confirm the secret crosses from private to public.
- Apply context scoped access so a public driven session cannot reach the private repo, and confirm the same injection now fails while legitimate public work still succeeds.
- Add a cross context write check that flags private origin content being written to a public destination.
- Audit a real integration you use that spans trust levels, a GitHub, cloud, or SaaS connector, and ask: when the agent acts on untrusted input, what is the full scope of what its token can reach. Note whether that scope matches the trust of the input.
Point 5 is the real world action. Almost every broad connector token is this incident waiting for the right issue. The fix is always the same: the reach in an untrusted context must match the trust of that context.
Day 20 turns to the slowest and stealthiest vector, memory and RAG poisoning, where the attacker plants content in one session or one document and the agent detonates it later, in a context the attacker is no longer present for.