CVE-2024-7774: LangChain.js: path traversal, arbitrary file read/write

CRITICAL PoC AVAILABLE CISA: TRACK*
Published October 29, 2024
CISO Take

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
135.7K OpenSSF 6.5 2.6K dependents Pushed 7d ago 17% patched ~256d to patch Full package profile →

Do you use langchain.js? You're affected.

Severity & Risk

CVSS 3.1
9.1 / 10
EPSS
0.6%
chance of exploitation in 30 days
Higher than 69% of all CVEs
Exploitation Status
Exploit Available
Exploitation: MEDIUM
Sophistication
Trivial
Exploitation Confidence
medium
CISA SSVC: Public PoC
Public PoC indexed (trickest/cve)
Composite signal derived from CISA KEV, CISA SSVC, EPSS, trickest/cve, and Nuclei templates.

Attack Surface

AV AC PR UI S C I A
AV Network
AC Low
PR None
UI None
S Unchanged
C High
I High
A None

Recommended Action

5 steps
  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.

CISA SSVC Assessment

Decision Track*
Exploitation poc
Automatable No
Technical Impact partial

Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.

Classification

Compliance Impact

This CVE is relevant to:

EU AI Act
Article 15 - Accuracy, robustness and cybersecurity
ISO 42001
A.8.3 - AI system security controls
NIST AI RMF
MANAGE-2.2 - Risk Response — AI risk treatment
OWASP LLM Top 10
LLM06 - Sensitive Information Disclosure LLM07 - Insecure Plugin Design

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

Timeline

Published
October 29, 2024
Last Modified
May 28, 2025
First Seen
October 29, 2024

Related Vulnerabilities