OSV 1.4.0 · github-reviewed · 修改于 2026-06-09 18:56
发布时间
2026-05-12 00:16
GitHub 审查时间
2026-05-12 00:16
NVD 发布时间
2026-05-14 00:17
源文件
advisories/github-reviewed/2026/05/GHSA-9ccr-r5hg-74gf/GHSA-9ccr-r5hg-74gf.json
A security vulnerability has been identified in GitHub Copilot CLI where a malicious bare git repository nested inside a project directory can achieve arbitrary code execution when the agent performs git operations. By exploiting git's automatic bare repository discovery during directory traversal, an attacker can set core.fsmonitor or other executable config keys to run arbitrary commands without user awareness or approval.
Git supports bare repositories — repositories without a working tree — which can be discovered automatically when git traverses the directory hierarchy looking for a .git directory. When git discovers a bare repository, it reads and applies its configuration, including keys that specify external commands to execute.
The vulnerability arises because git's core.fsmonitor config key (and 15+ similar keys such as core.hookspath, diff.external, merge.tool, etc.) can specify arbitrary shell commands that git will execute as part of normal operations like status, diff, or rev-parse.
An attacker can exploit this by:
vendor/malicious.git/ or a deeply nested subdirectory)core.fsmonitor (or similar keys) in that bare repository to execute a malicious commandThis can occur when:
git status, git diff, or other routine git commandsgrep or glob that may trigger git operations in subdirectoriesPrior to the fix, the CLI had no protection against git auto-discovering bare repositories during directory traversal.
An attacker who can place a malicious bare repository inside a project — for example, through:
— could achieve arbitrary code execution on the user's workstation whenever GitHub Copilot CLI performs git operations in or near the malicious directory.
Successful exploitation could lead to data exfiltration, credential theft, file modification, or further system compromise.
The fix sets safe.bareRepository=explicit via git's GIT_CONFIG_COUNT / GIT_CONFIG_KEY_* / GIT_CONFIG_VALUE_* environment variable mechanism, which has the highest precedence over all config file sources. This prevents git from automatically discovering and using bare repositories during directory traversal — only explicitly allowlisted bare repositories will be used.
vendor/, third_party/, or deeply nested subdirectories.