CVE-2026-55443: LangChain: Path traversal and sandbox escape in LangChain file-search middleware and loaders
LangChain's file-search middleware, prompt and agent configuration loaders, and path-prefix checks do not confine resolved paths to their root. Globs, symlinks or untrusted config can read files outside the intended directory. Upgrade langchain to 1.3.9 and langchain-anthropic to 1.4.6.
Published Jun 16, 2026 · Updated Jul 8, 2026 · Analysis Oct 26, 2026
What an attacker can do
Three behaviors share one root cause: the code checks the path as written, not where it ends up.
The file-search agent middleware validates the starting directory, but not the search pattern or the real target of each match. A glob pattern or a symlink inside the workspace can therefore point outside the configured root. Prompt and chain/agent configuration loaders accept path fields and resolve them without confining the result to a trusted base or rejecting symlink targets. Path-prefix authorization checks compare strings with no path-segment boundary, so a sibling such as /data/app-secrets passes a check for /data/app.
The attacker needs to influence a path, a search pattern or workspace contents. That can be an LLM acting on untrusted input, such as a prompt-injected agent with file-search tools, or config loaded from a shared or untrusted source. The result is disclosure of file contents outside the boundary, which the CVSS 3.1 vector rates as high confidentiality with high attack complexity and local access. Nothing is written or deleted. The advisory says there is no evidence of exploitation in the wild, and that callers using only trusted inputs and first-party config are not affected.
Who is affected
pip package langchain up to and including 1.3.8, and langchain-anthropic up to and including 1.4.5. You are exposed if you give an agent filesystem-search middleware over a directory and accept prompts or retrieved content from untrusted sources, load prompt or chain/agent config from untrusted or shared sources, or rely on path-prefix rules to confine tool file access.
Check your versions:
pip show langchain langchain-anthropiclangchain
- Ecosystem
- PyPI
- Affected
- <= 1.3.8
- Fixed in
- 1.3.9
- Check
pip show langchain
langchain-anthropic
- Ecosystem
- PyPI
- Affected
- <= 1.4.5
- Fixed in
- 1.4.6
- Check
pip show langchain-anthropic
How to fix it
Upgrade langchain to 1.3.9 and langchain-anthropic to 1.4.6:
pip install -U "langchain>=1.3.9" "langchain-anthropic>=1.4.6"The fix resolves symlinks and checks that the real path stays inside the root, normalizes search patterns, makes config loaders confine path fields and reject symlink escapes, and adds a segment boundary to prefix checks. Callers that deliberately reference external paths can opt in through the existing dangerous-loading flag.
The advisory also advises confining filesystem-backed agent tools to a dedicated directory, running them sandboxed or in a container, and never enabling dangerous loading for config you do not control.
How to tell if you were hit
The advisory gives no log signatures. Review agent tool-call logs for file-search calls whose glob patterns contain .. or absolute paths, or whose matches resolve outside the configured root. Search the workspace for symlinks pointing out of it, for example with find . -type l. Check config files loaded by LangChain for path fields that point outside your trusted base. Where an LLM handled untrusted input, look for reads of sensitive files such as .env, SSH keys or cloud credentials that the task did not need.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
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.
Credited to Mistz1, deprrous.
Questions
- Which LangChain versions fix this advisory?
langchain 1.3.9 and langchain-anthropic 1.4.6. Versions up to 1.3.8 and 1.4.5 are affected.
- Can a prompt injection trigger this?
Yes, if an agent has file-search middleware and an LLM turns untrusted input into search patterns or paths. The advisory names an LLM acting on untrusted input as one source of influenced values.
- Am I affected if I only use trusted inputs?
The advisory says callers who confine these components to fully trusted inputs and first-party configuration are not affected.
- Is this exploited in the wild?
The advisory says there is no evidence of it being triggered in the wild. It is not in CISA's KEV catalog.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More LangChain vulnerabilities
All LangChain entriesCVE-2026-45134
LangSmith SDK: Public prompt pull deserializes untrusted manifests without trust boundary warning
high7.1May 13, 2026CVE-2026-44843
LangChain vulnerable to unsafe deserialization of attacker-controlled objects through overly broad `load()` allowlists
high8.2May 8, 2026CVE-2026-40087
LangChain has incomplete f-string validation in prompt templates
medium5.3Apr 8, 2026CVE-2026-34070
LangChain Core has Path Traversal vulnerabilites in legacy `load_prompt` functions
high7.5Mar 27, 2026CVE-2026-27795
LangChain Community: redirect chaining can lead to SSRF bypass via RecursiveUrlLoader
medium4.1Feb 25, 2026CVE-2026-26013
LangChain affected by SSRF via image_url token counting in ChatOpenAI.get_num_tokens_from_messages
low3.7Feb 11, 2026
