Medium

LangChain: Path traversal and sandbox escape in LangChain file-search middleware and loaders

  • Disclosed: 16.06.2026
  • Updated: 11.10.2026 15:17

Summary

Several LangChain components that resolve filesystem paths or expand search patterns do not consistently confine the resolved path to the intended root directory. Affected behaviors include: a file-search agent middleware that validates a starting directory but not the search pattern or the resolved target of matched files, so glob patterns and symlinks can reach files outside the configured root; prompt- and chain/agent-configuration loaders that accept path fields and resolve them without confining the result to a trusted base or rejecting symlink targets; and path-prefix authorization checks that compare by string prefix without a path-segment boundary, so a sibling path sharing the prefix is accepted. When these components receive path values, search patterns, or workspace contents influenced by an untrusted source — including an LLM acting on untrusted input — the result can be disclosure of files outside the intended boundary. We have no evidence of this behavior being triggered in the wild.

Affected users / systems

You may be affected if you expose an agent with filesystem-search middleware over a directory and accept prompts or retrieved content influenced by untrusted sources; load prompt or chain/agent configuration from untrusted or shared sources; or rely on path-prefix restrictions to confine tool file access. Callers that confine these components to fully trusted inputs and first-party configuration are not affected.

Impact

  • Confidentiality: disclosure of file contents outside the intended root/sandbox.
  • Authorization: path-prefix bypass can grant access to sibling resources beyond the intended subtree.

Patches / mitigation

The affected components will canonicalize candidate paths (resolving symlinks) and verify the resolved real path remains within the configured root before reading or returning it; search patterns will be normalized so they cannot escape the root; configuration loaders will confine resolved path fields and reject symlink escapes unless the caller explicitly opts in to dangerous loading; and path-prefix checks will enforce a path-segment boundary. Path validation will be made operating-system-portable.

Compatibility

Callers that already pass only in-root paths, validated configuration, and trusted search inputs see no behavioral change. Callers that intentionally reference external paths can opt in via the existing dangerous-loading flag.

Operational guidance

Confine filesystem-backed agent tools to a dedicated directory and prefer running them sandboxed/containerized; validate path and identifier inputs where untrusted input enters; do not enable dangerous loading for configuration whose origin you do not control.

LangSmith / hosted deployments note

This issue concerns library components executed by agents.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) langchain < 1.3.9 1.3.9
Python (PyPI) langchain-anthropic < 1.4.6 1.4.6

References

CVSS score 5.1/10
CVSS vector
CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Weakness (CWE)
CWE-22, CWE-59
Platform
Python (PyPI)
Package
langchain, langchain-anthropic
Disclosed
16.06.2026
Updated
11.10.2026 15:17

Sources and licenses

OSV / GitHub Advisory Database - PYSEC-2026-2192 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - PYSEC-2026-2556 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-gr75-jv2w-4656 - CC BY 4.0

Vulnerability history: langchain

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (22) in the archive
Total entries
22
First → latest
04.2023 06.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • Critical 12
  • High 4
  • Medium 4
  • Low 2

Disclosures per year

  1. 2023: 15
  2. 2024: 5
  3. 2025: 0
  4. 2026: 2
Severity:
  1. LangChain: Path traversal and sandbox escape in LangChain file-search middleware and loaders this entry
    Medium · 5.1 CVE-2026-55443 < 1.3.9 1.3.9
  2. High · 7.5 CVE-2023-32786 < 0.0.329 0.0.329
  3. Critical · 9.8 CVE-2023-32785 < 0.0.247 0.0.247
  4. Critical · 9.8 CVE-2023-36188 < 0.0.247 0.0.247
  5. Critical · 9.8 CVE-2023-34541 < 0.0.247 0.0.247
  6. Critical · 9.8 CVE-2023-34540 < 0.0.225 0.0.225

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.