CVE-2026-87008: Code Graph RAG: symlink path traversal enables file read/write
GHSA-85gg-2gfq-q95mHIGHCode Graph RAG, an AI-powered code knowledge graph tool, fails to resolve symbolic links before its path containment check, so a symlink planted in an analyzed repository can point to files outside the project root. The structural_search tool then reads those files (credentials, keys, .env files) with no approval gate, and structural_replace with dry_run=False can overwrite writable files, including via the MCP path, which skips the agent-loop approval control. Exploitation requires a victim to analyze a hostile repository, and there is no public exploit, no Nuclei template and no KEV listing. EPSS is low at 0.26% (82nd percentile), but the package has 526 downstream dependents and 17 prior CVEs, so supply-chain exposure and a weak security history are real concerns. Upgrade to 0.0.589 (the advisory text lists 0.0.587 as the patched version in the structured data, so use the later release), and avoid running the tool against untrusted repositories or with high-privilege credentials until then.
What is the risk?
High severity (CVSS 7.1, local vector, low complexity, no privileges, user interaction required) with high confidentiality and integrity impact. Exploitation likelihood is low to moderate: EPSS is 0.00264, no public exploit exists and it is not in CISA KEV. Risk rises sharply for developers and CI systems that routinely analyze third-party or untrusted repositories, and for hosts where the process can reach secrets or SSH keys. The package scores 28/100 on package risk, with 17 other CVEs, which indicates an uneven security track record.
How does the attack unfold?
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| Pydantic AI | pip | <= 0.0.586 | 0.0.587 |
Do you use Pydantic AI? You're affected.
How severe is it?
What is the attack surface?
What should I do?
1 step1) Upgrade code-graph-rag to 0.0.589 or later (the structured data lists 0.0.587 as the first patched release, but the advisory states the fix in 0.0.589, so prefer the latter). 2) Do not analyze untrusted or third-party repositories with an unpatched version. 3) Run the tool and MCP server under a low-privilege account or in a container/sandbox with no access to home directories, secrets or SSH keys. 4) Require human approval for structural_replace and keep dry_run=True by default. 5) Before analysis, scan repositories for symlinks that resolve outside the root, for example with find -type l combined with readlink -f checks. 6) Review process and audit logs for structural_search or structural_replace calls touching paths outside the project root, and rotate any credentials that may have been exposed.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2026-87008?
Code Graph RAG, an AI-powered code knowledge graph tool, fails to resolve symbolic links before its path containment check, so a symlink planted in an analyzed repository can point to files outside the project root. The structural_search tool then reads those files (credentials, keys, .env files) with no approval gate, and structural_replace with dry_run=False can overwrite writable files, including via the MCP path, which skips the agent-loop approval control. Exploitation requires a victim to analyze a hostile repository, and there is no public exploit, no Nuclei template and no KEV listing. EPSS is low at 0.26% (82nd percentile), but the package has 526 downstream dependents and 17 prior CVEs, so supply-chain exposure and a weak security history are real concerns. Upgrade to 0.0.589 (the advisory text lists 0.0.587 as the patched version in the structured data, so use the later release), and avoid running the tool against untrusted repositories or with high-privilege credentials until then.
Is CVE-2026-87008 actively exploited?
No confirmed active exploitation of CVE-2026-87008 has been reported, but organizations should still patch proactively.
How to fix CVE-2026-87008?
1) Upgrade code-graph-rag to 0.0.589 or later (the structured data lists 0.0.587 as the first patched release, but the advisory states the fix in 0.0.589, so prefer the latter). 2) Do not analyze untrusted or third-party repositories with an unpatched version. 3) Run the tool and MCP server under a low-privilege account or in a container/sandbox with no access to home directories, secrets or SSH keys. 4) Require human approval for structural_replace and keep dry_run=True by default. 5) Before analysis, scan repositories for symlinks that resolve outside the root, for example with find -type l combined with readlink -f checks. 6) Review process and audit logs for structural_search or structural_replace calls touching paths outside the project root, and rotate any credentials that may have been exposed.
What systems are affected by CVE-2026-87008?
This vulnerability affects the following AI/ML architecture patterns: agent frameworks, RAG pipelines, MCP servers, AI coding assistants, code knowledge graph systems.
What is the CVSS score for CVE-2026-87008?
CVE-2026-87008 has a CVSS v3.1 base score of 7.1 (HIGH). The EPSS exploitation probability is 0.26%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.005AI Agent ToolAML.T0037Data from Local SystemAML.T0053AI Agent Tool InvocationAML.T0055Unsecured CredentialsCompliance Controls Affected
What are the technical details?
Original Advisory
Code Graph RAG is an AI-powered knowledge graph and retrieval system for querying, understanding, and editing multi-language codebases. Prior to 0.0.589, AstGrepService in codebase_rag/tools/ast_grep_service.py enumerates files beneath project_root and relies on should_skip_path in codebase_rag/utils/path_utils.py to classify them, but the containment check operates on unresolved lexical paths. A symbolic link planted inside an analyzed repository can therefore reference a file outside the configured root while still appearing in scope. The structural_search tool follows the link and discloses readable content without an approval gate, while structural_replace with dry_run=False follows it and overwrites writable content; the MCP path invokes structural replacement without the agent-loop approval control. An attacker who causes a victim to analyze a repository containing such a link can read credentials, keys, environment files, or sibling source and can modify files accessible to the code-graph-rag process. This issue is fixed in version 0.0.589.
Exploitation Scenario
An attacker publishes or contributes a repository, such as an open-source project or a pull request, containing symlinks named like ordinary source files that point to ~/.aws/credentials, ~/.ssh/id_rsa or a project .env file. A developer or CI job clones it and indexes it with Code Graph RAG. Because the containment check works on unresolved lexical paths, the links pass as in-scope. A structural_search query, whether from the user or an agent, returns the secret contents into the session or LLM context, where they can be exfiltrated. The attacker can also use structural_replace through the MCP path, with no approval prompt, to overwrite a writable file such as a shell rc file or a build script, gaining persistence or code execution later.
Weaknesses (CWE)
CWE-22Improper Limitation of a Pathname to a Restricted DirectoryPrimaryCWE-22Improper Limitation of a Pathname to a Restricted DirectoryPrimaryCWE-59Improper Link Resolution Before File AccessPrimaryCWE-59Improper Link Resolution Before File AccessPrimaryCWE-22Improper Limitation of a Pathname to a Restricted DirectoryCWE-59Improper Link Resolution Before File AccessCWE-22 — Improper Limitation of a Pathname to a Restricted Directory: 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.
- [Implementation] Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylis
- [Architecture and Design] For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:NReferences
Timeline
Related Vulnerabilities
CVE-2026-255808.6pydantic-ai: SSRF allows internal network access
Same package: pydantic-aiCVE-2026-1072867.5Pydantic AI: stream slot leak enables remote DoS
Same package: pydantic-aiCVE-2026-542496.8Pydantic AI: UploadedFile refs leak cloud storage
Same package: pydantic-aiCVE-2026-487826.8pydantic-ai: SSRF IPv6 bypass exposes cloud IAM creds
Same package: pydantic-aiCVE-2026-256405.4pydantic-ai: Path Traversal enables file access
Same package: pydantic-ai