GitHub Copilot CLI's Bare-Repo RCE Fix Is a Reminder That Coding Agents Inherit Every Old Developer-Tool Footgun

GitHub Copilot CLI's Bare-Repo RCE Fix Is a Reminder That Coding Agents Inherit Every Old Developer-Tool Footgun

The Copilot CLI bug is the kind of security issue that should make engineering teams more uncomfortable than a flashy prompt-injection demo. Not because the exploit is exotic. Because it is painfully ordinary.

GitHub shipped Copilot CLI 1.0.43 on May 8, following a May 6 fix for a vulnerability where a malicious nested bare Git repository could trigger arbitrary command execution when the agent performed normal Git operations. Affected versions before 1.0.42 could be exploited through Git’s automatic bare-repository discovery and executable configuration keys such as core.fsmonitor, core.hookspath, diff.external, and merge.tool. The fix forces safe.bareRepository=explicit via Git environment configuration, which prevents Git from implicitly discovering buried bare repositories during directory traversal.

That sounds like a Git footnote until you put it in the context of coding agents. Copilot CLI is not a passive autocomplete box. It inspects repositories, runs Git commands, reads files, keeps task context, and tries to move work forward on behalf of a developer. The same behaviors that make an agent useful also make it a high-quality trigger for old developer-tool vulnerabilities. A malicious project no longer needs to convince a human to run ./install.sh. It can wait for an agent to run git status while doing its job.

The exploit path is boring. That is the warning.

The advisory describes a straightforward attack. An attacker places a malicious bare Git repository inside a project, for example vendor/malicious.git/. When Copilot CLI performs routine Git operations near that directory — git status, git diff, rev-parse, or related commands — Git may auto-discover the bare repository, read its configuration, and execute commands through config keys designed to integrate external helpers. The advisory calls out core.fsmonitor and notes there are more than fifteen similar executable keys.

This is not a brand-new primitive. Justin Steven documented buried bare repository attacks in 2022, showing how embedded bare repos plus core.fsmonitor could lead to command execution in IDEs, shell prompts, and Git-integrated tooling. His recommendation then was to strongly consider safe.bareRepository=explicit. GitHub’s Copilot CLI fix is basically that advice applied at the agent boundary, using GIT_CONFIG_COUNT, GIT_CONFIG_KEY_*, and GIT_CONFIG_VALUE_* so the safer setting takes precedence over normal config files.

That is the right layer for the fix. It does not ask the model to “be careful.” It constrains the tool the model depends on. Agent security gets much more credible when controls live in deterministic places: Git config, process isolation, shell permissions, sandbox policy, network egress, tool allowlists, and identity boundaries. A model refusal is useful. It is not a substitute for hardening the command it is about to run.

The practical remediation for Copilot CLI users is simple: upgrade to 1.0.43 or later. The more important remediation for engineering organizations is broader: find every agentic tool that runs Git automatically. Copilot CLI is only one surface. Cursor, Claude Code, Codex, OpenClaw, IDE extensions, CI assistants, repository bots, pre-commit automation, and internal “developer productivity” agents may all inspect Git state without a user noticing. If those tools inherit unsafe Git defaults, they inherit this class of bug.

Agent supply chain now includes the repo itself

Security teams are used to thinking about software supply chain in terms of packages, lockfiles, build scripts, container images, and CI credentials. Coding agents add another layer: the working tree is now an instruction and execution environment. Repository contents can influence what the agent reads, what it trusts, what tools it invokes, and where it looks next. That makes hidden Git metadata, project-local instructions, MCP configuration, task hooks, and vendored directories part of the agent supply chain.

The May 8 Copilot CLI release notes include a second item worth reviewing through that lens: userPromptSubmitted hooks can now handle requests directly and bypass the LLM. That may be excellent for deterministic workflows, but it also expands the instruction and plugin layer that needs audit. “Bypass the LLM” is not automatically bad. It is often exactly how you make a workflow predictable. But it means the security boundary moves from model behavior to hook implementation, install provenance, and permission scoping.

This is where most agent security programs are still underbuilt. Teams are buying or building autonomous coding tools faster than they are defining operational policy for them. Which directories can the agent traverse? Which Git settings are enforced regardless of user config? Can it run shell commands without approval? Can repository-local instructions change tool permissions? Are hooks versioned and reviewed? Can the agent access credentials from the host environment? Does it run in a container, a VM, or the developer’s actual machine with all the ambient authority that implies?

The answer should not be “ban agents.” That is not realistic, and it leaves developers to run unapproved tools anyway. The better answer is to treat agent execution like production automation. Standardize safe.bareRepository=explicit where possible. Scan vendored and dependency directories for unexpected bare repos. Run agents in sandboxes with minimal credentials. Keep human approval gates for commands that mutate files, install packages, touch secrets, or call external services. And document which agent integrations are allowed to run inside corporate repositories.

The uncomfortable part is that many of these controls are not AI-specific. They are old secure-engineering basics applied to a new actor. That is exactly why this bug matters. The model did not hallucinate its way into RCE. The agent inherited a footgun from the developer toolchain. As agents become normal parts of the software workflow, inherited footguns become autonomous footguns. Upgrade Copilot CLI, yes. Then go audit the rest of the terminal you just handed to a robot.

Sources: GitHub Copilot CLI releases, GitHub security advisory GHSA-9ccr-r5hg-74gf, Justin Steven’s buried bare repo research, Git safe.bareRepository documentation