# CVE-2024-7774: Langchain path traversal in file operations

Source: https://junglewise.ai/threats/cve-2024-7774-langchain-path-traversal-in-file-operations  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2024-10-29. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2024-7774 · Severity: low · CVSS 3 · Published 2024-10-29

Langchain is a popular library for building applications with large language models. A path traversal vulnerability in its file handling code allows attackers to save, read, overwrite, and delete files anywhere on a system where the application runs, bypassing intended directory restrictions and potentially compromising sensitive data or application integrity.

Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2024-7774 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2024-7774 being exploited in the wild.

**How severe is CVE-2024-7774?** Low severity, with a CVSS score of 3, published 29 October 2024.

**Which products and versions are affected?** langchain (npm) SEMVER:introduced=0,fixed=0.2.19.

**Is there a fix for CVE-2024-7774?** Yes. langchain (npm): upgrade to 0.2.19 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2024-7774 attacked?** It is attacked over the network.

**Am I affected by CVE-2024-7774?** Check whether you run langchain (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- langchain (npm): upgrade to 0.2.19 or later

  ```sh
  npm install langchain@0.2.19
  ```


## Technical details

A path traversal vulnerability exists in the getFullPath method of langchain (npm package) versions prior to 0.2.19, exploitable through setFileContent, getParsedFile, and mdelete methods. The vulnerability stems from insufficient input sanitization when constructing file paths, allowing attackers to use path traversal sequences (e.g., ../) to escape the intended directory. The attack vector is network-based with no authentication or user interaction required (CVSS 3.0 AV:N/AC:L/PR:N/UI:N). An attacker can read text files, write files to arbitrary locations, overwrite existing files, and delete files on the affected system. A fix was released in version 0.2.19 (commit a0fad77).

## Affected products

- Langchain langchain before 0.2.19

## Identifiers

- CVE-2024-7774
- GHSA-hc5w-c9f8-9cc4

## Timeline

- 2024-10-29: disclosed
- 2024-10-29: patched: Fix released in version 0.2.19

## References

- [https://github.com/langchain-ai/langchainjs/commit/a0fad77d6b569e5872bd4a9d33be0c0785e538a9](https://github.com/langchain-ai/langchainjs/commit/a0fad77d6b569e5872bd4a9d33be0c0785e538a9)

## Related threats

- [LangChain serialization injection enables secret extraction](https://junglewise.ai/threats/cve-2025-68665-langchain-serialization-injection-enables-secret-extraction)
