CVE-2024-7774CWE-29

Path Traversal in langchain-ai/langchainjs

Medium · published October 29, 2024

CVSS v3.0
6.5
EPSS
1%
Percentile
45.7
In the wild
Unconfirmed
What it is

⚠️ An overlooked detail in `getFullPath` could let attackers decide where to save files — think of it as a delivery person dropping packages anywhere they please, instead of the correct address! 📦 Imagine if a delivery service didn’t check the address before leaving your packages. A misfiled delivery could end up at the neighbor's or, worse, at the dumpster behind the building! That’s what happens here with the `getFullPath` method in LangChainJS, allowing malicious users to manipulate filesystem paths. With this vulnerability, an attacker could overwrite existing text files, read sensitive `.txt` files, or even delete important data. In a world where data is king, such access can lead to disastrous consequences — loss of crucial information and potential exploitation of other systems.

Put simply

Imagine if a delivery service didn’t check the address before leaving your packages. A misfiled delivery could end up at the neighbor's or, worse, at the dumpster behind the building! That’s what happens here with the `getFullPath` method in LangChainJS, allowing malicious users to manipulate filesystem paths. The path traversal vulnerability in `getFullPath` arises because methods like `setFileContent`, `getParsedFile`, and `mdelete` fail to properly sanitize user input, allowing dangerous file path manipulations.

What to do

With this vulnerability, an attacker could overwrite existing text files, read sensitive `.txt` files, or even delete important data. In a world where data is king, such access can lead to disastrous consequences — loss of crucial information and potential exploitation of other systems. To secure your application, upgrade to LangChainJS version 0.2.6 or later. Additionally, implement input validation and sanitation for all file path operations to prevent these attacks from happening in the future. You've got this! By following these steps, you’ll strengthen your system and keep those pesky attackers at bay. 🛡️

The record
Technical detail
CVSS v3.0
6.5 · MEDIUM
Vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N
CVSS v4.0
Not supplied
EPSS
0.00557 · 45.7th percentile
Weakness
CWE-29 · Path Traversal: '\..\filename'
Published
2024-10-29T12:49Z
EPSS history
Timeline
  • 29 OCT 12:49Z
    Path Traversal in langchain-ai/langchainjs
    cvelistv5