---
title: "GHSA-hc5w-c9f8-9cc4: Langchain Path Traversal vulnerability"
description: "Moderate severity. Langchain Path Traversal vulnerability. Affects langchain; fixed in 0.2.19."
url: https://inlinr.com/advisories/GHSA-hc5w-c9f8-9cc4
lang: en
---

[Packages](https://inlinr.com/packages) / [langchain](https://inlinr.com/packages/langchain) / [Security](https://inlinr.com/packages/langchain/security)

Moderate Vulnerability GHSA-hc5w-c9f8-9cc4 CVE-2024-7774 Published 29 Oct 2024

# Langchain Path Traversal vulnerability

Your version 

Affected releases · [langchain](https://inlinr.com/packages/langchain)

- 0.2.x 0.2.0 – 0.2.18 Fixed in 0.2.19
- 0.1.x and older 0.0.1 – 0.1.37 No fix, no longer updated

On 0.2.x, the newest line:

```
npm install langchain@0.2.19
```

Every release on a timeline

1.x 

1. Not affected

1.0.0 – 1.6.7  
95 releases, latest

0.x 

1. Affected

0.0.1 – 0.2.18  
269 releases
2. Fixed

0.2.19 – 0.3.37  
40 releases

404 stable releases of langchain, oldest to newest, one row per major.

## What happens

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.

## How it is exploited

Exploitable over the network, with no account and no action from a user.

- **Confidentiality**: low
- **Integrity**: low
- **Availability**: none

CVSS:3.0/​AV:N/​AC:L/​PR:N/​UI:N/​S:U/​C:L/​I:L/​A:N

## References

- [NVD](https://nvd.nist.gov/vuln/detail/CVE-2024-7774 "https://nvd.nist.gov/vuln/detail/CVE-2024-7774")  
nvd.nist.gov/vuln/detail/CVE-2024-7774
- [Fix commit](https://github.com/langchain-ai/langchainjs/commit/a0fad77d6b569e5872bd4a9d33be0c0785e538a9 "https://github.com/langchain-ai/langchainjs/commit/a0fad77d6b569e5872bd4a9d33be0c0785e538a9")  
a0fad77
- [Package](https://github.com/langchain-ai/langchainjs "https://github.com/langchain-ai/langchainjs")  
github.com/langchain-ai/langchainjs
- [Reference](https://github.com/pypa/advisory-database/tree/main/vulns/langchain/PYSEC-2024-111.yaml "https://github.com/pypa/advisory-database/tree/main/vulns/langchain/PYSEC-2024-111.yaml")  
github.com/pypa/advisory-database/tree/main/vul…
- [Reference](https://huntr.com/bounties/8fe40685-b714-4191-af7a-3de5e5628cee "https://huntr.com/bounties/8fe40685-b714-4191-af7a-3de5e5628cee")  
huntr.com/bounties/8fe40685-b714-4191-af7a-3de5…

A whole project to check? Paste its package.json in the [dependency check](https://inlinr.com/tools/dependency-check): every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.
