Severity:

HIGH RISK

(7.3)

Path Traversal in Spire Doc MCP Server get_doc_path Handler

CVE-2026-7314

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Unauthorized File System Access and Information Disclosure

Severity:

HIGH RISK

(7.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path traversal vulnerability in the get_doc_path function of eiceblue spire-doc-mcp-server 1.0.0 allows remote attackers to manipulate the document_name parameter to access unintended files on the server.

When user-controlled document names are not properly validated or normalized, crafted input can escape the intended document directory and potentially expose sensitive data or other application resources.

Affected context

The issue occurs in deployments of spire-doc-mcp-server 1.0.0 that accept a document_name value from clients and pass it into get_doc_path to resolve a file on disk.

The vulnerability is present when:

  • The application constructs filesystem paths from user input
  • The server has access to directories or files beyond the intended document storage root
  • There is no robust canonicalization or restriction of the resolved path back to an expected base directory

Exploit preconditions

  • Attack surface: Network-exposed API endpoints that call get_doc_path with a document_name parameter.
  • Required access: Ability to send crafted HTTP or protocol-level requests to the spire-doc-mcp-server instance; no local filesystem access is required.
  • Trigger point: Supplying a specially formed document_name value (for example, using traversal sequences) that the server uses directly to compute a filesystem path.
  • Why exploitation is possible: User-controlled path components are concatenated or joined with a base directory without sufficient normalization, validation, or enforcement that the final resolved path remains within an allowed directory scope.

Why this happens

This vulnerability stems from constructing filesystem paths directly from untrusted input and failing to enforce directory constraints on the resolved path.

In abstract terms, this matches CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where input that should reference only files within a designated folder is accepted without validating or canonicalizing it against that folder.

The code likely joins a base directory with document_name (or similar) and relies on the filesystem to interpret the result, allowing traversal sequences or absolute paths to escape the intended document directory.

Potential impact

  • Access to files outside the intended document directory that the server process can read
  • Disclosure of application configuration files, logs, or system information
  • Exposure of credentials, keys, or other sensitive data stored on the server
  • Use of local file contents to aid in further attacks against the application or host

General mitigation guidance

Effective mitigation focuses on constraining how user input influences filesystem paths and strictly defining allowed locations:

  • Normalize and canonicalize any constructed path and verify it resides under a pre-defined base directory before use (e.g., compare canonical paths).
  • Maintain an allowlist of valid document identifiers or filenames and map them to server-side paths, rather than accepting arbitrary path fragments from clients.
  • Avoid exposing raw filesystem structure through API parameters; instead use opaque IDs or references.
  • Run the server process with least-privilege filesystem permissions so that even if traversal is attempted, access to sensitive areas is limited.
  • Centralize path-handling utility functions that enforce these checks consistently across all file access points.

How teams detect issues like this

Detection typically combines code-level review with runtime monitoring:

  • Static analysis: Flag direct use of user-controlled variables in file operations (open, os.path.join, path libraries) without preceding validation or base-directory checks.
  • Code review cues: Look for APIs that accept filenames or paths and construct paths by string concatenation or simple joins; verify they enforce a fixed root directory and canonicalization.
  • Security tests: Incorporate automated tests or DAST scans that attempt directory traversal patterns (../, URL-encoded traversal) against endpoints that return or process files.
  • Logging and monitoring: Instrument file access routines to log when requested paths resolve outside the expected document root; alert on such events for investigation.

Sources

SourceLink
github.comgithub.com/eiceblue/spire-doc-mcp-server/
github.comgithub.com/eiceblue/spire-doc-mcp-server/issues/1
vuldb.comvuldb.com/submit/803080
vuldb.comvuldb.com/vuln/359962
vuldb.comvuldb.com/vuln/359962/cti

Frequently asked

questions

Any remote user who can reach the affected endpoints and supply a document_name parameter may be able to trigger path traversal, subject to network controls and authentication the deployment might enforce.

Typically no local or system-level privileges are required; the attacker only needs the level of access necessary to call the API. However, what they can ultimately read depends on filesystem permissions of the server process.

Treat document_name as an identifier rather than a path: resolve it through a controlled mapping to known-safe locations, and ensure that any derived paths are canonicalized and verified to remain under a defined document root before opening files.

Establish a standard file-access abstraction that centralizes path validation, enforce least-privilege filesystem permissions, and include path traversal checks in code review and automated testing so that new endpoints cannot introduce unchecked path construction.

Find out what's already
exploitable in your codebase.