CVE-2026-7811
Path Traversal in code-mcp MCP File Handler
Publication date: 2026-05-05
Last updated on: 2026-05-05
Assigner: VulDB
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| 54yyyu | code-mcp | to 4cfc4643541a110c906d93635b391bf7e357f4a8 (inc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-22 | The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
This vulnerability exists in the function is_safe_path within the file src/code_mcp/server.py of the MCP File Handler component in the 54yyyu code-mcp project. It allows an attacker to perform a path traversal attack by manipulating the function, potentially accessing files and directories outside the intended scope.
The attack can be launched remotely, and the exploit has been publicly disclosed.
How can this vulnerability impact me? :
This vulnerability can allow an attacker to access or manipulate files outside the intended directory structure, potentially exposing sensitive information or enabling further attacks.
Since the attack can be performed remotely without authentication, it increases the risk of unauthorized data access or modification.
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
The vulnerability allows unauthorized read and write access to files outside the intended workspace, leading to high confidentiality and integrity risks. Such unauthorized access to sensitive data can result in violations of data protection regulations like GDPR and HIPAA, which mandate strict controls over personal and sensitive information.
By enabling path traversal attacks, the vulnerability undermines the security controls designed to protect data confidentiality and integrity, potentially exposing or altering protected health information (PHI) or personally identifiable information (PII). This exposure can lead to non-compliance with regulatory requirements that require safeguarding such data.
Mitigations such as restricting service access, limiting filesystem permissions, and disabling high-risk tools are necessary to reduce the risk of regulatory non-compliance.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability involves a path traversal issue caused by improper path validation in the is_safe_path function, allowing crafted paths with traversal segments like '..' to bypass checks.
Detection can be approached by monitoring file operations or commands that attempt to access files outside the intended workspace using traversal patterns.
Suggested commands include searching for file access attempts with traversal sequences in logs or running scripts to detect usage of paths containing '..' or similar patterns in the MCP file handler operations.
- Use grep or similar tools to search logs for suspicious file paths, e.g., `grep -r '\.\./' /path/to/logs`.
- Audit MCP file handler usage by checking commands or API calls that include path traversal sequences.
- Perform static code analysis or manual review focusing on the is_safe_path function and its path validation logic.
What immediate steps should I take to mitigate this vulnerability?
Immediate mitigation steps include restricting access to the MCP service to trusted users only, limiting filesystem permissions to prevent unauthorized file read/write, and disabling high-risk MCP file tools that allow file operations.
Additionally, applying or implementing canonical path checks (e.g., using Path.resolve()) to reject traversal segments in file paths is recommended to prevent exploitation.
Centralizing and strengthening path validation logic in the is_safe_path function or equivalent components is also advised.