Advisory

GHSA-9gfj-28hw-jchp

Details, part 2 of 2. The advisory

Details

However, in internal/permissions/registry.go, docs.update is classified as CapWrite:

"docs.update":  {Capability: CapWrite, Target: TargetDoc, Risk: RiskMedium},

This allows an attacker with a read-write-no-delete preset (which permits CapWrite but denies CapDelete) to delete files by using docs.update with a newPath parameter.

Attack Vector

| Phase | Request / Action | Effect |
| :--- | :--- | :--- |
| 1. Arbitrary File Read | docs.get with path="../../../victim/secret" | Server reads file outside project root via path traversal in DocStore.Get(). |
| 2. Arbitrary File Write | docs.create with folder="../../../victim" | Server writes file outside project root via path traversal in DocStore.Create(). |
| 3. Arbitrary File Delete | docs.update with path="../outside/secret.md" and newPath="../../../victim/renamed.md" | Server deletes file outside project root via path traversal in DocStore.Rename(). Bypasses CapDelete restriction because docs.update is classified as CapWrite. |
| 4. Memory File Read/Write | memory.update with id="x/../../../../victim/secret" | Server reads and overwrites file outside project root via path traversal in MemoryStore.Update(). |

Analysis

Classic Path Traversal Pattern

Both DocStore and MemoryStore follow the same vulnerable pattern: user-controlled input is concatenated with a base directory using filepath.Join(), then passed directly to file system operations (os.ReadFile, os.WriteFile, os.Remove, os.Stat) without any validation.

absPath := filepath.Join(baseDir, filepath.FromSlash(userInput))
// No containment check: strings.HasPrefix(absPath, baseDir)
// No rejection of ".." or absolute paths

filepath.Join resolves ../ sequences, allowing attackers to escape the intended directory:

  • Input: "../../../etc/passwd"
  • Result: /project/.knowns/docs/../../../etc/passwd → /etc/passwd

Rename-as-Delete Authorization Bypass

The Rename() function performs two operations:

  1. Write the file to the new location (newAbsPath)
  2. Delete the file from the old location (oldAbsPath)

Both paths are vulnerable to traversal. An attacker can:

  • Set path to a file outside the project (e.g., "../../../victim/target.md")
  • Set newPath to another location outside the project
  • The Rename() function will delete the file at path (outside the project)

Because docs.update is classified as CapWrite rather than CapDelete, this operation bypasses deletion restrictions in read-write-no-delete presets.

Compounding Factor - Unauthenticated Access

Due to the previously identified Auth Bypass vulnerability, all MCP tools are accessible without credentials when the server is started without a password, making this a zero-credential attack.

Fix

*Patch is available right now at New Release.*

Sources & licences