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.
The `setFileContent`, `getParsedFile`, and `mdelete` methods do not properly sanitize user-supplied input data. This allows an attacker to craft a path containing sequences like `../`, which when processed by the `getFullPath` method lead outside the intended directory. As a result, it is possible to write files anywhere on the file system, overwrite existing text files, read `.txt` files, and delete files.
An attacker can read `.txt` files without authentication, overwrite or create files anywhere on the file system, and delete files — resulting in violation of data confidentiality and integrity on the server.
Apply patches available from the vendor according to references — fix available in the GitHub repository at: https://github.com/langchain-ai/langchainjs/commit/a0fad77d6b569e5872bd4a9d33be0c0785e538a9
langchain-ai/langchainjs version 0.2.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:NLangchain Langchain.js
APPLangchain0.2.5
Related vulnerabilities
LangChain is a framework for building LLM-powered applications. Prior to @langchain/core versions 0.3.80 and 1...
Podatność deserialization injection w funkcjach dumps/dumpd LangChain Core
SSRF w LangChain RequestsToolkit — dostęp do sieci wewnętrznej i metadanych chmury
SQL injection przez prompt injection w LangChain GraphCypherQAChain
SQL injection przez prompt injection w LangChain GraphCypherQAChain