CVE-2024-7774: LangChain.js: path traversal, arbitrary file read/write
CRITICAL PoC AVAILABLE CISA: TRACK*CVE-2024-7774 is a critical (CVSS 9.1) unauthenticated path traversal in LangChain.js v0.2.5 — no credentials or user interaction required. Attackers can read, overwrite, or delete arbitrary files on any server running the affected file tools. Patch to commit a0fad77d immediately; if not possible, containerize with read-only volume mounts and restrict the process to minimal filesystem permissions.
Risk Assessment
Extremely high exploitability: network-accessible, zero privileges, zero user interaction, low complexity. Any LangChain.js deployment exposing file-handling tools (setFileContent, getParsedFile, mdelete) is trivially compromised. Wide blast radius in AI pipelines where file tools are routinely used for document ingestion, RAG, and agent memory. The EPSS data gap does not reduce severity — the attack mechanics are straightforward path traversal with no mitigating factors in the CVSS vector.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| langchain.js | pip | — | No patch |
Do you use langchain.js? You're affected.
Severity & Risk
Attack Surface
Recommended Action
5 steps-
Patch immediately: apply commit a0fad77d6b569e5872bd4a9d33be0c0785e538a9 or upgrade LangChain.js beyond v0.2.5.
-
If patching is delayed: run the process under a restricted OS user with filesystem access limited to a designated working directory; use Docker with explicit volume mounts and no access to sensitive paths.
-
Deploy WAF rules blocking path traversal patterns (../, ..\ , %2e%2e%2f) in inputs to file-handling endpoints.
-
Audit process-level file access logs for traversal patterns in LangChain.js tool invocations.
-
Inventory all .txt files accessible to the LangChain.js process and confirm none contain credentials, API keys, or PII.
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-7774?
CVE-2024-7774 is a critical (CVSS 9.1) unauthenticated path traversal in LangChain.js v0.2.5 — no credentials or user interaction required. Attackers can read, overwrite, or delete arbitrary files on any server running the affected file tools. Patch to commit a0fad77d immediately; if not possible, containerize with read-only volume mounts and restrict the process to minimal filesystem permissions.
Is CVE-2024-7774 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2024-7774, increasing the risk of exploitation.
How to fix CVE-2024-7774?
1. Patch immediately: apply commit a0fad77d6b569e5872bd4a9d33be0c0785e538a9 or upgrade LangChain.js beyond v0.2.5. 2. If patching is delayed: run the process under a restricted OS user with filesystem access limited to a designated working directory; use Docker with explicit volume mounts and no access to sensitive paths. 3. Deploy WAF rules blocking path traversal patterns (../, ..\ , %2e%2e%2f) in inputs to file-handling endpoints. 4. Audit process-level file access logs for traversal patterns in LangChain.js tool invocations. 5. Inventory all .txt files accessible to the LangChain.js process and confirm none contain credentials, API keys, or PII.
What systems are affected by CVE-2024-7774?
This vulnerability affects the following AI/ML architecture patterns: agent frameworks, RAG pipelines, LLM application backends, document processing pipelines.
What is the CVSS score for CVE-2024-7774?
CVE-2024-7774 has a CVSS v3.1 base score of 9.1 (CRITICAL). The EPSS exploitation probability is 0.60%.
Technical Details
NVD Description
A path traversal vulnerability exists in the `getFullPath` method of langchain-ai/langchainjs version 0.2.5. This vulnerability allows attackers to save files anywhere in the filesystem, overwrite existing text files, read `.txt` files, and delete files. The vulnerability is exploited through the `setFileContent`, `getParsedFile`, and `mdelete` methods, which do not properly sanitize user input.
Exploitation Scenario
An adversary targeting a LangChain.js-powered document assistant crafts a filename such as '../../../../app/config/secrets.txt' and submits it through a publicly accessible file retrieval endpoint backed by getParsedFile. Without sanitization, the server resolves the traversal and returns file contents. The attacker then uses setFileContent with a traversed path to overwrite a tool definition file, injecting malicious instructions into the agent's behavior for future sessions. Finally, mdelete is invoked with a traversed path to erase access logs, covering the intrusion. No credentials are required at any step.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N 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