CVE-2025-68145: Verified Repro With Script Download
CVE-2025-68145: MCP Server Git: Path Traversal via Missing Repository Path Validation
CVE-2025-68145 is verified against mcp-server-git · pip. Affected versions: < 2025.12.18. Fixed in 2025.12.18. Vulnerability class: Path Traversal. This critical reproduction includes runnable sandbox proof, artifacts, and a plain-text agent view under REPRO-2026-00076.
What Is CVE-2025-68145?
CVE-2025-68145 (GHSA-j22h-9j4x-23w5) is a medium-severity path traversal vulnerability in mcp-server-git, where the server fails to validate that repo_path arguments stay within the repository configured by the --repository flag. Pruva reproduced it (reproduction REPRO-2026-00076).
CVE-2025-68145 Severity & CVSS Score
CVE-2025-68145 is rated critical severity, with a CVSS base score of 9.1 out of 10.
Critical — the most severe class — typically remotely exploitable with severe impact. Treat as an emergency.
Affected mcp-server-git Versions
mcp-server-git · pip versions < 2025.12.18 are affected.
How to Reproduce CVE-2025-68145
pruva-verify REPRO-2026-00076 curl -O https://pruva.dev/api/v1/reproductions/REPRO-2026-00076/artifacts/reproduction_steps.sh && chmod +x reproduction_steps.sh && ./reproduction_steps.sh Proof of Reproduction for CVE-2025-68145
Reproduced by Pruva's autonomous agents — 155 tool calls over 11 min. Full root-cause analysis and the complete transcript are below.
How the agent worked
Root Cause and Exploit Chain for CVE-2025-68145
Summary
mcp-server-git versions prior to 2025.12.18 do not validate that the repo_path argument supplied to tool calls remains within the repository configured by the --repository flag. As a result, a client can call tools (e.g., git_status) against any other Git repository accessible to the server process, defeating the intended restriction.
Impact
- Affected component: mcp-server-git Python package (stdio MCP server)
- Affected versions: < 2025.12.18 (reproduced with 2025.11.25)
- Risk level: Medium
- Consequence: Clients can read or manipulate repositories outside the configured allowed repository, including via path traversal or symlink escapes.
Root Cause
The vulnerable server implementation directly converts repo_path from tool call arguments into a Path and opens it with git.Repo(...) without checking whether it is inside the configured --repository path. The fix (2025.12.18) introduces validate_repo_path, which resolves both the allowed repository and requested path (following symlinks) and rejects paths outside the allowed root before executing Git operations.
Reproduction Steps
- Run
repro/reproduction_steps.sh. - The script creates two Git repositories, starts the vulnerable server (2025.11.25) with
--repositoryset to the allowed repo, and callsgit_statusagainst outside paths (direct, traversal, and symlink). - The script repeats the call against the fixed server (2025.12.18) and confirms rejection.
Evidence
- Vulnerable behavior (access outside repo succeeds):
logs/vuln_outside_repo.log(showsisError Falsewith status output for the outside repo)logs/vuln_traversal_repo.loglogs/vuln_symlink_repo.log
- Fixed behavior (access outside repo blocked):
logs/fixed_outside_repo.loglogs/fixed_symlink_repo.log
- Environment: Python 3.11 with venvs created by the script, Git CLI used to initialize test repos.
Recommendations / Next Steps
- Upgrade mcp-server-git to 2025.12.18 or later.
- Ensure all tool entry points validate repository paths using resolved paths (including symlinks) before performing Git operations.
- Add regression tests covering path traversal and symlink escape cases.
Additional Notes
repro/reproduction_steps.shwas executed twice successfully to verify idempotence.- The test covers direct path usage, relative traversal, and symlink escapes to match the fixed validation logic.
CVE-2025-68145 Reproduction Transcript
The agent's step-by-step process — every tool call, every handoff, the moment the exploit fired.
Full session Replay every step — scrub the timeline or play it back.
ls -latotal 27 drwxr-xr-x 6 root root 4096 Jan 21 07:32 . drwxr-xr-x 4 root root 4096 Jan 21 07:32 .. drwxr-xr-x 3 root root 4096 Jan 21 07:32 artifacts drwxr-xr-x 2 root root 4096 Jan 21 07:32 coding -rw-r--r-- 1 root root 635 Jan 21 07:32 handoffs.jsonl drwxr-xr-x 2 root root 4096 Jan 21 07:32 logs drwxr-xr-x 2 root root 4096 Jan 21 07:32 repro
{"output":"{\"returncode\": 0, \"stdout\": \"total 27\\ndrwxr-xr-x 6 root root 4096 Jan 21 07:32 .\\ndrwxr-xr-x 4 root root 4096 Jan 21 07:32 ..\\ndrwxr-xr-x 3 root root 4096 Jan 21 07:32 artifacts\\ndrwxr-xr-x 2 root ro"}cat ticket.md# GHSA-j22h-9j4x-23w5: mcp-server-git has missing path validation when using --repository flag ## Description In mcp-server-git versions prior to 2025.12.18, when the server is started with the --repository flag to restrict operations to a specific repository path, it did not validate that repo_path arguments in subsequent tool calls were actually within that configured path. This could allow tool calls to operate on other repositories accessible to the server process. The fix adds path validation that resolves both the configured repository and the requested path (following symlinks) and verifies the requested path is within the allowed repository before executing any git operations. Users are advised to upgrade to 2025.12.18 to remediate this issue. Thank you to https://hackerone.com/yardenporat for reporting. ## Severity
{"output":"{\"returncode\": 0, \"stdout\": \"# GHSA-j22h-9j4x-23w5: mcp-server-git has missing path validation when using --repository flag\\n\\n## Description\\nIn mcp-server-git versions prior to 2025.12.18, when the "}ls -la artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repols: cannot access 'artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repo': No such file or directory
{"output":"{\"returncode\": 2, \"stdout\": \"\", \"stderr\": \"ls: cannot access 'artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repo': No such file or directory\\n\", \"cwd\": \"/home/user/pruva/artifacts/runs/ghsa-j22h-"}ls -la /home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236total 21 drwxr-xr-x 4 root root 4096 Jan 21 07:32 . drwxr-xr-x 4 root root 4096 Jan 21 07:32 .. drwxr-xr-x 6 root root 4096 Jan 21 07:32 ghsa-j22h-9j4x-23w5 drwxr-xr-x 2 root root 4096 Jan 21 07:32 repo -rw-r--r-- 1 root root 523 Jan 21 07:32 trace.json -rw-r--r-- 1 root root 3705 Jan 21 07:33 trace_spans.jsonl
{"output":"{\"returncode\": 0, \"stdout\": \"total 21\\ndrwxr-xr-x 4 root root 4096 Jan 21 07:32 .\\ndrwxr-xr-x 4 root root 4096 Jan 21 07:32 ..\\ndrwxr-xr-x 6 root root 4096 Jan 21 07:32 ghsa-j22h-9j4x-23w5\\ndrwxr-xr-x"}ls -la /home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repototal 8 drwxr-xr-x 2 root root 4096 Jan 21 07:32 . drwxr-xr-x 4 root root 4096 Jan 21 07:32 ..
{"output":"{\"returncode\": 0, \"stdout\": \"total 8\\ndrwxr-xr-x 2 root root 4096 Jan 21 07:32 .\\ndrwxr-xr-x 4 root root 4096 Jan 21 07:32 ..\\n\", \"stderr\": \"\", \"cwd\": \"/home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-2"}ls -la /home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/ghsa-j22h-9j4x-23w5/artifacts/preppedtotal 8 drwxr-xr-x 2 root root 4096 Jan 21 07:32 . drwxr-xr-x 3 root root 4096 Jan 21 07:32 ..
{"output":"{\"returncode\": 0, \"stdout\": \"total 8\\ndrwxr-xr-x 2 root root 4096 Jan 21 07:32 .\\ndrwxr-xr-x 3 root root 4096 Jan 21 07:32 ..\\n\", \"stderr\": \"\", \"cwd\": \"/home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-2"}git --versiongit version 2.43.0
{"output":"{\"returncode\": 0, \"stdout\": \"git version 2.43.0\\n\", \"stderr\": \"\", \"cwd\": \"/home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/ghsa-j22h-9j4x-23w5\"}"}git clone https://github.com/modelcontextprotocol/servers /home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repoCloning into '/home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repo'...
{"output":"{\"returncode\": 0, \"stdout\": \"\", \"stderr\": \"Cloning into '/home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repo'...\\n\", \"cwd\": \"/home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20"}ls -la /home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repototal 528 drwxr-xr-x 6 root root 4096 Jan 21 07:33 . drwxr-xr-x 4 root root 4096 Jan 21 07:32 .. drwxr-xr-x 8 root root 4096 Jan 21 07:33 .git -rw-r--r-- 1 root root 42 Jan 21 07:33 .gitattributes drwxr-xr-x 3 root root 4096 Jan 21 07:33 .github -rw-r--r-- 1 root root 5306 Jan 21 07:33 .gitignore -rw-r--r-- 1 root root 123 Jan 21 07:33 .mcp.json
{"output":"{\"returncode\": 0, \"stdout\": \"total 528\\ndrwxr-xr-x 6 root root 4096 Jan 21 07:33 .\\ndrwxr-xr-x 4 root root 4096 Jan 21 07:32 ..\\ndrwxr-xr-x 8 root root 4096 Jan 21 07:33 .git\\n-rw-r--r-- 1 root "}grep -R "mcp-server-git" -n /home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repo/src | head -n 20/home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repo/src/git/README.md:1:# mcp-server-git: A git MCP server /home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repo/src/git/README.md:9:Please note that mcp-server-git is currently in early development. The functionality and available tools are subject to change and expansion as we continue to develop and improve the server. /home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repo/src/git/README.md:104:use [`uvx`](https://docs.astral.sh/uv/guides/tools/) to directly run *mcp-server-git*. /home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repo/src/git/README.md:108:Alternatively you can install `mcp-server-git` via pip: /home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repo/src/git/README.md:111:pip install mcp-server-git /home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repo/src/git/README.md:133: "args": ["mcp-server-git", "--repository", "path/to/git/repo"] /home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repo/src/git/README.md:171:[![Install with UV in VS Code](https://img.shields.io/badge/VS_Code-UV-0098F… [truncated]
{"output":"{\"returncode\": 0, \"stdout\": \"/home/user/pruva/artifacts/runs/ghsa-j22h-9j4x-23w5/20260121-073236/repo/src/git/README.md:1:# mcp-server-git: A git MCP server\\n/home/user/pruva/artifacts/runs/ghsa-j22h-"}Artifacts and Evidence for CVE-2025-68145
Scripts, logs, diffs, and output captured during the reproduction.
No artifacts available
How to Fix CVE-2025-68145
Upgrade mcp-server-git · pip to 2025.12.18 or later.
FAQ: CVE-2025-68145
How does the CVE-2025-68145 path-traversal attack work?
Which mcp-server-git versions are affected by CVE-2025-68145, and where is it fixed?
How severe is CVE-2025-68145?
How can I reproduce CVE-2025-68145?
References for CVE-2025-68145
Authoritative sources for CVE-2025-68145 — official vulnerability databases and the upstream advisory. Pruva's reproduction verifies the issue firsthand; these are the primary records to corroborate it.