CVE-2026-87008: Code Graph RAG: symlink path traversal enables file read/write

GHSA-85gg-2gfq-q95mHIGH
Published November 5, 2026
CISO Take

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.

Sources:NVDEPSSGitHub AdvisoryATLASgithub.com/vitali87/code-graph-rag

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?

Initial Access
The attacker plants symlinks pointing to sensitive files outside the root in a repository the victim will analyze.
AML.T0010.005
Execution
The victim indexes the repository, and the lexical path check treats the symlinks as in-scope files.
AML.T0053
Collection
structural_search follows the links and returns credentials, keys or environment files without an approval gate.
AML.T0037
Impact
structural_replace with dry_run=False, especially via MCP, overwrites writable files outside the root, enabling tampering or persistence.

What systems are affected?

PackageEcosystemVulnerable RangePatched
Pydantic AIpip<= 0.0.5860.0.587
21.1K526 dependentsPushed 5d ago94% patched~68d to patchFull package profile →

Do you use Pydantic AI? You're affected.

How severe is it?

CVSS 3.1
7.1 / 10
EPSS
0.3%
chance of exploitation in 30 days
Higher than 18% of all CVEs
Exploitation Status
No known exploitation
Sophistication
Trivial

What is the attack surface?

AVACPRUISCIA
AVLocal
ACLow
PRNone
UIRequired
SUnchanged
CHigh
IHigh
ANone

What should I do?

1 step
  1. 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.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

ISO 42001
A.6.2.6-AI system operation and monitoring
NIST AI RMF
MANAGE 2.3-Respond to previously unknown risks and mechanisms for disengagement
OWASP LLM Top 10
LLM02-Sensitive Information DisclosureLLM03-Supply ChainLLM06-Excessive Agency

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

agent frameworksRAG pipelinesMCP serversAI coding assistantscode knowledge graph systems

MITRE ATLAS Techniques

AML.T0010.005AI Agent Tool
AML.T0037Data from Local System
AML.T0053AI Agent Tool Invocation
AML.T0055Unsecured Credentials

Compliance Controls Affected

ISO 42001: A.6.2.6
NIST AI RMF: MANAGE 2.3
OWASP LLM Top 10: LLM02, LLM03, LLM06

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-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:N

Timeline

Published
November 5, 2026
Last Modified
November 9, 2026
First Seen
November 5, 2026

Related Vulnerabilities