CVE-2026-77604: Code Graph RAG: MCP paginated read_file path traversal / arbitrary file read
Code Graph RAG is an AI-powered knowledge graph and retrieval system for querying, understanding, and editing multi-language codebases. Prior to 0.0.345, the MCPToolsRegistry.readfile implementation in codebaserag/mcp/tools.py joins attacker-controlled filepath input to projectroot without resolving and verifying containment when offset or limit selects the paginated branch. An absolute path causes pathlib to discard the configured root, while relative traversal can also resolve outside it. The protected non-paginated branch uses validateprojectpath, but the paginated branch bypasses that validation before opening the path. An unauthenticated caller of a network-exposed HTTP MCP server can therefore read arbitrary UTF-8-readable files available to the server process, including credentials, environment data, private keys, source, and configuration; local callers through the stdio transport can reach the same vulnerable code path. This issue is fixed in version 0.0.345.
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Code Graph RAGto a version that resolves this vulnerability.Fixed in 0.0.345
Event History
Frequently Asked Questions
Which deployments are exposed to unauthenticated remote file reads?
A network-exposed HTTP MCP server is exposed because an unauthenticated caller can invoke the vulnerable read_file path. Local callers using the stdio transport can also reach the same code path, but they require local access.
What input is required to trigger the vulnerable code path?
The caller must use read_file with offset or limit so that execution takes the paginated branch. An absolute file path or a relative path containing traversal can then reference files outside the configured project root.
Are all read_file requests affected?
No. The non-paginated branch uses validate_project_path, while the paginated branch bypasses containment validation before opening the file. The issue is therefore tied to requests that select pagination through offset or limit.
What can be read if exploitation succeeds?
An attacker can read UTF-8-readable files accessible to the server process. This can include credentials, environment data, private keys, source code, and configuration files.
What remediation is available?
Upgrade Code Graph RAG to version 0.0.345, which fixes the issue. If upgrading cannot occur immediately, the provided data supports limiting exposure of the HTTP MCP server and treating files readable by its process as potentially accessible.