Severity:

HIGH RISK

(7.3)

Path Traversal in filesystem-mcp-server read/write Tools

CVE-2026-7400

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read/Write on Server Filesystem

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 is_path_allowed function of server.py in filesystem-mcp-server 1.0.0 allows attackers to read from or write to files outside the intended directory.

When remote requests can influence file paths for the read/write tools, an attacker may escape the sandboxed root and access arbitrary locations on the host filesystem.

Affected context

This issue affects deployments using filesystem-mcp-server 1.0.0 where:

  • The read_file_tool and/or write_file_tool in server.py are exposed over a network API.
  • The server relies on is_path_allowed to enforce which filesystem paths can be accessed.
  • Client-controlled input (e.g., request parameters or tool arguments) is used to build file paths.

In such environments, incomplete normalization or validation in is_path_allowed can allow directory traversal outside the intended base path.

Exploit preconditions

  • Attack surface: Remote interface of the filesystem MCP server (e.g., HTTP, RPC, or tool protocol endpoint).
  • Required access: Ability to invoke the read/write tools and supply arbitrary or partially controlled file paths.
  • Trigger point: Calls to read_file_tool or write_file_tool that pass user-supplied paths through is_path_allowed.
  • Why exploitation is possible: The path validation logic does not fully neutralize traversal sequences (such as ../) or alternate path encodings, allowing paths that resolve outside the restricted directory to be treated as allowed.

Why this happens

The root cause is insufficient path canonicalization and validation in the is_path_allowed function, which is responsible for checking whether a requested path is within an allowed directory.

Instead of validating against a fully normalized, absolute path and enforcing a strict directory boundary, the implementation likely relies on string operations or incomplete checks.

This maps directly to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where attackers can craft path values that escape the intended root and reach arbitrary filesystem locations.

Potential impact

  • Read access to sensitive files on the server (e.g., configuration files, keys, logs, or user data).
  • Unauthorized modification or deletion of files if the write tool is exposed and reachable.
  • Indirect execution of code if an attacker can overwrite scripts, configuration, or data consumed by other processes.
  • Expanded attack surface for further compromise by harvesting credentials or environment secrets stored on disk.

General mitigation guidance

Effective mitigation centers on strict path normalization and enforcement of directory boundaries:

  • Resolve all user-supplied paths to absolute, canonical form before any access checks and file operations.
  • Enforce that the canonical path is a descendant of an explicitly configured base directory (e.g., by comparing path prefixes using filesystem-aware APIs rather than string concatenation).
  • Reject or sanitize inputs containing traversal patterns, ambiguous encodings, or disallowed characters.
  • Limit the server process to least-privilege filesystem permissions so even successful traversal attempts are constrained.
  • Consider implementing an explicit allowlist for accessible directories or file types, and deny all access by default.

How teams detect issues like this

Detection usually involves both code-focused and behavior-focused approaches:

  • Static analysis: Scan for manual string-based path checks (e.g., naive startswith on paths, direct concatenation of base path + user input) and missing canonicalization before access.
  • Code review: Look for functions like is_path_allowed that enforce sandbox boundaries and verify they use secure, canonical path comparison patterns and a well-defined base directory.
  • Runtime monitoring: Inspect server logs for suspicious paths containing ../, absolute paths where only relative paths are expected, or attempts to access system directories.
  • Automated testing: Add security test cases that attempt directory traversal with varying encodings and path tricks to validate that the sandbox cannot be escaped.

Sources

SourceLink
github.comgithub.com/geekgod382/filesystem-mcp-server/
github.comgithub.com/geekgod382/filesystem-mcp-server/commit/45364545fc60dc80aadcd4379f08042d3d3d292e
github.comgithub.com/geekgod382/filesystem-mcp-server/issues/1
github.comgithub.com/geekgod382/filesystem-mcp-server/releases/tag/v1.1.0
vuldb.comvuldb.com/submit/803495
vuldb.comvuldb.com/vuln/360123
vuldb.comvuldb.com/vuln/360123/cti

Frequently asked

questions

Yes. The vulnerability is exploitable remotely when the filesystem MCP server exposes the read/write tools over a network interface that accepts user-controlled path input.

An attacker needs the ability to invoke the affected file tools and supply path arguments. This may be through authenticated or unauthenticated access, depending on how the server is deployed and integrated.

The safest pattern is to canonicalize paths to an absolute form, enforce that they reside under a configured base directory using filesystem-aware checks, and deny any path that falls outside that boundary. This should be done in a central validation function used by all file operations.

Adopt a standard utility for secure path handling, avoid ad-hoc string checks, integrate security-focused code review for filesystem access logic, and include automated tests that attempt directory traversal as part of your regular CI pipeline.

Find out what's already
exploitable in your codebase.