CVE-2024-3571: LangChain: path traversal allows arbitrary file R/W
HIGH PoC AVAILABLE CISA: TRACK*Any LangChain deployment using LocalFileStore is exposed to unauthenticated file system access by low-privileged users — patch immediately or disable LocalFileStore. CVSS 8.8 with network vector and low complexity means this is trivially exploitable by any authenticated app user. If you run LangChain-based agents or RAG pipelines in production, treat this as critical until patched.
Risk Assessment
High risk. CVSS 8.8 with AV:N/AC:L/PR:L reflects real-world exploitability: any authenticated user of an application backed by LangChain's LocalFileStore can traverse directories. No AI/ML expertise required — standard path traversal techniques apply. The risk compounds in agentic architectures where LocalFileStore is used as a caching or memory layer: successful exploitation can expose model artifacts, API keys, training data, or system credentials stored on disk. File write capability creates a direct path to RCE via cron jobs, SSH authorized_keys, or Python import paths.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| langchain | pip | — | No patch |
Do you use langchain? You're affected.
Severity & Risk
Attack Surface
Recommended Action
5 steps-
Patch: upgrade to the commit aad3d8bd47d7f5598156ff2bdcc8f736f24a7412 or any LangChain release incorporating it — verify your pinned version includes this fix.
-
Workaround if immediate patching is not possible: replace LocalFileStore with an in-memory or database-backed store (Redis, PostgreSQL) and revoke filesystem access from the LangChain process.
-
Principle of least privilege: run LangChain processes under a dedicated service account with access limited strictly to required directories via filesystem ACLs or container mount restrictions.
-
Detection: audit access logs for path traversal sequences (../, %2e%2e) in storage keys; monitor for anomalous file access outside expected working directories via auditd or eBPF-based tools.
-
Inventory: identify all services using LangChain — check requirements.txt, poetry.lock, and Dockerfile references across repos.
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2024-3571?
Any LangChain deployment using LocalFileStore is exposed to unauthenticated file system access by low-privileged users — patch immediately or disable LocalFileStore. CVSS 8.8 with network vector and low complexity means this is trivially exploitable by any authenticated app user. If you run LangChain-based agents or RAG pipelines in production, treat this as critical until patched.
Is CVE-2024-3571 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2024-3571, increasing the risk of exploitation.
How to fix CVE-2024-3571?
1. Patch: upgrade to the commit aad3d8bd47d7f5598156ff2bdcc8f736f24a7412 or any LangChain release incorporating it — verify your pinned version includes this fix. 2. Workaround if immediate patching is not possible: replace LocalFileStore with an in-memory or database-backed store (Redis, PostgreSQL) and revoke filesystem access from the LangChain process. 3. Principle of least privilege: run LangChain processes under a dedicated service account with access limited strictly to required directories via filesystem ACLs or container mount restrictions. 4. Detection: audit access logs for path traversal sequences (../, %2e%2e) in storage keys; monitor for anomalous file access outside expected working directories via auditd or eBPF-based tools. 5. Inventory: identify all services using LangChain — check requirements.txt, poetry.lock, and Dockerfile references across repos.
What systems are affected by CVE-2024-3571?
This vulnerability affects the following AI/ML architecture patterns: RAG pipelines, agent frameworks, LLM application backends, model serving.
What is the CVSS score for CVE-2024-3571?
CVE-2024-3571 has a CVSS v3.1 base score of 8.8 (HIGH). The EPSS exploitation probability is 2.02%.
Technical Details
NVD Description
langchain-ai/langchain is vulnerable to path traversal due to improper limitation of a pathname to a restricted directory ('Path Traversal') in its LocalFileStore functionality. An attacker can leverage this vulnerability to read or write files anywhere on the filesystem, potentially leading to information disclosure or remote code execution. The issue lies in the handling of file paths in the mset and mget methods, where user-supplied input is not adequately sanitized, allowing directory traversal sequences to reach unintended directories.
Exploitation Scenario
An attacker with low-privilege access to a LangChain-backed RAG application (e.g., a customer-facing Q&A chatbot) crafts a storage key containing traversal sequences such as `../../../../etc/passwd` or `../../../../app/.env` and calls the mget method via an exposed API endpoint or indirectly through prompt injection that triggers a cache lookup. The application resolves the path without sanitization, returning the contents of arbitrary files. In write mode via mset, the attacker plants a Python file in a package directory or a cron job payload in /etc/cron.d, achieving remote code execution on the next import or scheduled execution. In a multi-tenant SaaS deployment, one tenant could exfiltrate another tenant's cached data or the host's cloud provider instance metadata credentials.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H References
Timeline
Related Vulnerabilities
CVE-2025-2828 10.0 LangChain RequestsToolkit: SSRF exposes cloud metadata
Same package: langchain CVE-2023-34541 9.8 LangChain: RCE via unsafe load_prompt deserialization
Same package: langchain CVE-2023-29374 9.8 LangChain: RCE via prompt injection in LLMMathChain
Same package: langchain CVE-2023-34540 9.8 LangChain: RCE via JiraAPIWrapper crafted input
Same package: langchain CVE-2023-36258 9.8 LangChain: unauthenticated RCE via code injection
Same package: langchain
AI Threat Alert