Copilot Agent Mode Patch Bypass: Issue Text Becomes Token Theft
- Source
- hacktron.ai
- Author
- HacktronAI
- Date
Security firm Hacktron says it bypassed a VS Code fix for a prompt injection path in which text from a GitHub issue, written by anyone, is followed by Copilot agent mode once a developer starts work on it. The thread argues the underlying problem is not one bug but the agent's inability to separate the user's instructions from content it reads. The claim comes from the researchers, and the cited thread includes no vendor response. The practical defense does not depend on the patch status: treat issue bodies, pull request text and comments as untrusted input to any coding agent, keep the agent's permissions scoped, and review commands before they run.

Context
Copilot's mode in VS Code will read a GitHub issue and act on it: when a maintainer clicks "Code with agent mode" on an issue, a Codespace opens and Copilot runs the issue's description automatically. That is convenient and also dangerous, because anyone can file an issue. An earlier attack used this to turn attacker-written issue text into remote code execution, and Microsoft's fix added a confirmation prompt before Copilot writes sensitive files such as .vscode/settings.json. A write-up from Hacktron, promoted again in an October 13 post, describes getting around that confirmation. Its author says they found the original attack and then asked Hacktron's tool to find a bypass of the patch.
The bypass is a time-of-check to time-of-use gap: the safeguard checks one thing, then the action does another. Copilot applies edits through a patch format where an "Update File" line names a file and an optional "Move to" line renames it. According to the write-up, the code that decides which files need confirmation reads only the Update File and Add File lines, while the code that applies the patch also honors Move to and overwrites the destination. So a patch that looks like it edits a harmless new file can instead be moved onto a sensitive path such as .git/config, with no confirmation, because the check only ever saw the harmless source name. The proof of concept writes a malicious Git sshCommand that sends the GITHUB_ to an attacker's server and turns on VS Code's automatic fetching, so the next background git fetch runs the command and the token leaks.
A notable limit is that the attack needs a model that has Copilot's patch tool. The write-up says GPT-4.1 works best and that gpt-5-mini and raptor-mini also work, but that Claude models lack the tool, so the realistic version targets users without a paid Copilot plan, who get GPT models by default; premium users whose Copilot might pick a Claude model would not be hit. Neither the write-up nor the October post says whether the bypass has since been fixed, so that status is unknown here. Hacktron's broader point is the one in its post: an agent cannot tell the user's instructions from an attacker's, and untrusted text the agent reads can become commands it runs.
- AI agent — An AI system that doesn't just answer once but works toward a goal in a loop — taking actions, reading the results, and deciding what to do next.
- token — The chunk of text a model reads and writes in — roughly three-quarters of a word — and the unit AI usage is billed in.
- prompt injection — An attack that hides instructions in content an AI will read — a webpage, email, or document — tricking it into following the attacker instead of the user.
Checking sign-in…
Loading comments…






