/

CVE-2026-87008

Severity:

HIGH RISK

(7.1)

Symlink Following (CWE-59) in Code Graph RAG Tools

CVE-2026-87008

Received

Vulnerability type

Category:

Improper Link Resolution

CWE:

CWE-22, CWE-59

Impact:

Sensitive Information Disclosure and Unauthorized File Modification

Severity:

HIGH RISK

(7.1)

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

Code Graph RAG can follow a symbolic link inside an analyzed repository to a file outside the configured project root. If a victim analyzes a repository containing such a link, structural search may disclose readable files, and structural replacement may overwrite writable files without an approval gate.

Code Graph RAG can follow a symbolic link inside an analyzed repository to a file outside the configured project root. If a victim analyzes a repository containing such a link, structural search may disclose readable files, and structural replacement may overwrite writable files without an approval gate.

Affected context

The issue occurs when Code Graph RAG's AST-based tools enumerate and access files beneath a configured project root. The path check uses unresolved lexical paths, so a link that appears to be inside the root can point outside it. Risk depends on the analyzed repository containing such a link and on the process having access to the target file.

The issue occurs when Code Graph RAG's AST-based tools enumerate and access files beneath a configured project root. The path check uses unresolved lexical paths, so a link that appears to be inside the root can point outside it. Risk depends on the analyzed repository containing such a link and on the process having access to the target file.

Exploit preconditions

  • Attack surface: File access by structural search or structural replacement while analyzing a repository
  • Required access: An attacker must be able to provide or influence a repository that the victim analyzes
  • Trigger point: A tool follows a repository symlink during search or replacement
  • Why exploitation is possible: The containment check does not resolve the link target before access; the MCP replacement path also lacks the agent-loop approval control
  • Attack surface: File access by structural search or structural replacement while analyzing a repository
  • Required access: An attacker must be able to provide or influence a repository that the victim analyzes
  • Trigger point: A tool follows a repository symlink during search or replacement
  • Why exploitation is possible: The containment check does not resolve the link target before access; the MCP replacement path also lacks the agent-loop approval control

Why this happens

The path validation checks lexical paths without resolving symbolic links and verifying the resolved target remains within the configured root. File operations then follow the link, allowing access beyond the intended directory boundary. This is improper link resolution before file access (CWE-59) and can also result in path traversal (CWE-22).

The path validation checks lexical paths without resolving symbolic links and verifying the resolved target remains within the configured root. File operations then follow the link, allowing access beyond the intended directory boundary. This is improper link resolution before file access (CWE-59) and can also result in path traversal (CWE-22).

Potential impact

  • Structural search may disclose credentials, keys, environment files, or source code readable by the process
  • Structural replacement may modify files writable by the process outside the analyzed project
  • Sensitive data could be exposed or altered, depending on the process's permissions
  • Changes to accessible files could disrupt services or affect other projects
  • Structural search may disclose credentials, keys, environment files, or source code readable by the process
  • Structural replacement may modify files writable by the process outside the analyzed project
  • Sensitive data could be exposed or altered, depending on the process's permissions
  • Changes to accessible files could disrupt services or affect other projects

General mitigation guidance

Defensive patterns should ensure that file access remains confined to the intended project boundary:

  • Resolve candidate paths and verify their resolved targets remain within the configured root before reading or writing
  • Use filesystem operations and policies that prevent unintended symbolic-link following where practical
  • Apply equivalent boundary checks to enumeration, search, and replacement paths
  • Require explicit authorization for potentially destructive operations, including through alternate tool interfaces
  • Treat repository contents as untrusted input and run analysis with least-privilege filesystem permissions
  • Limit access to sensitive files and use read-only access when modification is not needed

Defensive patterns should ensure that file access remains confined to the intended project boundary:

  • Resolve candidate paths and verify their resolved targets remain within the configured root before reading or writing
  • Use filesystem operations and policies that prevent unintended symbolic-link following where practical
  • Apply equivalent boundary checks to enumeration, search, and replacement paths
  • Require explicit authorization for potentially destructive operations, including through alternate tool interfaces
  • Treat repository contents as untrusted input and run analysis with least-privilege filesystem permissions
  • Limit access to sensitive files and use read-only access when modification is not needed

How teams detect issues like this

  • Use static analysis to find path containment checks performed before canonicalization or without accounting for symbolic links
  • Review file enumeration and read/write code for operations that follow links outside a configured root
  • Check that all tool interfaces enforce consistent authorization and path-boundary policies
  • Add tests with links targeting both in-root and out-of-root files, verifying that reads and writes are constrained
  • Apply policy checks to flag filesystem access from untrusted repositories that is not confined to an approved workspace
  • Use static analysis to find path containment checks performed before canonicalization or without accounting for symbolic links
  • Review file enumeration and read/write code for operations that follow links outside a configured root
  • Check that all tool interfaces enforce consistent authorization and path-boundary policies
  • Add tests with links targeting both in-root and out-of-root files, verifying that reads and writes are constrained
  • Apply policy checks to flag filesystem access from untrusted repositories that is not confined to an approved workspace

Sources

SourceLink
github.comgithub.com/vitali87/code-graph-rag/commit/2648c95aa550ce2d9361a8e75ed669d5f4b451b8
github.comgithub.com/vitali87/code-graph-rag/releases/tag/v0.0.589
github.comgithub.com/vitali87/code-graph-rag/security/advisories/GHSA-85gg-2gfq-q95m

Frequently asked

questions

The described attack depends on a victim analyzing a repository containing a crafted symbolic link; it is not described as a standalone network attack.

An attacker needs a way to provide or influence a repository that the victim analyzes. The files at risk must also be accessible to the Code Graph RAG process.

Resolve paths and verify their targets remain inside the configured root before each file operation, while preventing unintended link following where possible.

Treat repository contents as untrusted, enforce consistent path and authorization checks across every tool interface, and run analysis with least-privilege filesystem access.

The described attack depends on a victim analyzing a repository containing a crafted symbolic link; it is not described as a standalone network attack.

An attacker needs a way to provide or influence a repository that the victim analyzes. The files at risk must also be accessible to the Code Graph RAG process.

Resolve paths and verify their targets remain inside the configured root before each file operation, while preventing unintended link following where possible.

Treat repository contents as untrusted, enforce consistent path and authorization checks across every tool interface, and run analysis with least-privilege filesystem access.

Find out what's already
exploitable in your codebase.