Published 2026-11-19 · Updated 2026-11-23 · Also known as GHSA-w42c-h7hr-f67p, GO-2026-7003
Summary
An arbitrary file write vulnerability exists in the Gortex MCP server due to missing repository confinement checks in the write_file, edit_file, and move_inline tools. Engineering and security teams using affected versions should update to the fixed version immediately.
Who is affected
Deployments running Gortex with MCP write tools enabled are vulnerable to repository confinement escapes when handling absolute paths. An adversarial or prompt-injected LLM agent can overwrite files outside the indexed repository roots, such as shell configuration files, git hooks, or cron jobs, leading to arbitrary code execution.
Exploitability
The vulnerability has a CVSS base score of 7.8 (High) with a vector indicating local/adjacent vector access requirements with user interaction required (e.g., tool call elicited from an agent). The EPSS score is 0.003 and it is not currently listed in the CISA Known Exploited Vulnerabilities catalog.
Remediation
Upgrade Go package github.com/zzet/gortex to version 0.55.0.
Ensure the remediation applies guardSymlinkWithinRepo and rejects absolute paths outside indexed roots on write_file, edit_file, and move_inline tools.
How to check your project
Check go.mod to see if github.com/zzet/gortex is used at versions prior to 0.55.0.
Inspect the codebase for usages of internal/mcp/tools_fileops.go and verify whether write paths incorporate symlink and repository confinement guards.
Automated analysis of the published advisory data, generated 2026-11-23. Not human-reviewed; verify against the official advisory. How this works.
Go package github.com/zzet/gortex is affected for versions introduced up to, but not including, 0.55.0.
Is there active exploitation documented in the wild?
No, CISA Known Exploited Vulnerabilities status is no.
What causes the vulnerability?
The resolveFilePath function exempts absolute paths from confinement, and the write handlers fail to call guardSymlinkWithinRepo unlike the read paths.
Original advisory description
### Summary
Gortex is an MCP server exposing `write_file`, `edit_file`, and `move_inline` tools. `resolveFilePath` **exempts absolute paths** from confinement, and the write handlers - unlike `read_file` / `get_symbol_source` - **never call `guardSymlinkWithinRepo`**. A single MCP `write_file` call with an absolute path writes any file the daemon user can, **outside every indexed repo root** (`AtomicWriteFile`'s `MkdirAll` auto-creates missing parents). Writing `~/.zshrc`, `~/.bashrc`, `.git/hooks/pre-commit`, or a cron/systemd unit yields code execution on the next shell/commit. This directly violates the project's own `SECURITY.md` invariant *"File-path resolution is **confined to indexed repository roots**"*
### Affected
`internal/mcp/tools_fileops.go` (+ `tools_move_inline.go`), HEAD `28fa017` (v0.53.0).
**CWE-22** (Path Traversal) / **CWE-73** (External Control of File Name/Path) → **CWE-94** (code execution).
### Vulnerable code
`internal/mcp/tools_fileops.go:54-62` `resolveFilePath` exempts absolute paths from the repo-root confinement; the write sink at `:793` (`AtomicWriteFile`, `write_file`) and `:676` (`edit_file`) run with **no** `guardSymlinkWithinRepo`. The asymmetry is the bug: `read_file` (`:940`) and `get_symbol_source` **do** call `guardSymlinkWithinRepo`; the write path does not.
### PoC (executed)
The PoC (`internal/mcp/poc_arbitrary_write_test.go`, package `mcp`) builds the server via the repo's **own** `newSingleRepoServer(t)` harness and invokes the real `srv.handleWriteFile` through the genuine `mcplib.CallToolRequest` shape:
```
=== RUN TestPoC_ArbitraryWrite_AbsolutePathEscapesEveryRepoRoot
indexed repo root (confinement boundary): /var/folders/.../myrepo
handler status=created path=/var/folders/.../003/pwn.txt bytes_written=50
PROOF: /var/folders/.../003/pwn.txt now exists with attacker bytes "OWNED-by-gortex-write_file-outside-every-repo-root"
RCE-PATH PROOF: wrote /var/folders/.../004/victim-home/.zshrc (parent dir auto-created) -> "echo PWNED_BY_GORTEX_RCE # injected via write_file"
VIOLATION of SECURITY.md line 17 ("It does not write to source files")
--- PASS (go test ok)
```
The test asserts the handler did **not** return `IsError` and that the files exist outside every repo root. (Full PoC available on request.)
### Impact
`write_file` / `edit_file` are MCP tools driven by an LLM agent. A prompt-injected or adversarial agent (the standard MCP threat model) writes any file the daemon user can - startup/hook/cron files → arbitrary code execution on the host running the daemon. Confinement (the security property `SECURITY.md` promises) is broken on the write path.
### Severity
**High - CVSS v3.1 `AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N` ≈ 8.x.** `UI:R` reflects that a tool call must be elicited from the agent (standard MCP injected-tool model). The RCE is a chain (write a startup/hook file → execute on next trigger), so `I:H` + the code-execution path. Floor: if the deployment never exposes write tools to untrusted input, impact is lower - but the tool is shipped and the confinement guard is simply absent on the write path.
### Remediation
Apply `guardSymlinkWithinRepo` (and reject absolute paths outside the indexed roots) on `write_file` / `edit_file` / `move_inline`, identically to `read_file` / `get_symbol_source`. Confinement must cover the write path.
### Dedup / freshness (re-verified live)
`gh api repos/zzet/gortex/security-advisories` → `[]` (none). `gh search prs/issues` for `resolveFilePath` / `guardSymlinkWithinRepo` / symlink / traversal / confinement → 0 (re-verified 2026-06-27; recent merges #175-#183 touch indexer/persistence, not the write path). `resolveFilePath` / `guardSymlinkWithinRepo` are gortex-own code (not vendored). **Fresh** at HEAD `28fa017`.