CVE-2024-7774: Langchain Path Traversal vulnerability
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.
Published Oct 29, 2024 · Updated Nov 1, 2024
Affected packages
langchain
- Ecosystem
- npm
- Affected
- < 0.2.19
- Fixed in
- 0.2.19
- Check
npm ls langchain
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
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.
Credited to hinthornw.
References
- https://nvd.nist.gov/vuln/detail/CVE-2024-7774
- https://github.com/langchain-ai/langchainjs/commit/a0fad77d6b569e5872bd4a9d33be0c0785e538a9
- https://huntr.com/bounties/8fe40685-b714-4191-af7a-3de5e5628cee
- https://github.com/pypa/advisory-database/tree/main/vulns/langchain/PYSEC-2024-111.yaml
- https://github.com/advisories/GHSA-hc5w-c9f8-9cc4
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More LangChain vulnerabilities
All LangChain entriesCVE-2026-55443
LangChain: Path traversal and sandbox escape in LangChain file-search middleware and loaders
medium5.1Jun 16, 2026CVE-2026-45134
LangSmith SDK: Public prompt pull deserializes untrusted manifests without trust boundary warning
high7.1May 13, 2026CVE-2026-44843
LangChain vulnerable to unsafe deserialization of attacker-controlled objects through overly broad `load()` allowlists
high8.2May 8, 2026CVE-2026-40087
LangChain has incomplete f-string validation in prompt templates
medium5.3Apr 8, 2026CVE-2026-34070
LangChain Core has Path Traversal vulnerabilites in legacy `load_prompt` functions
high7.5Mar 27, 2026CVE-2026-27795
LangChain Community: redirect chaining can lead to SSRF bypass via RecursiveUrlLoader
medium4.1Feb 25, 2026
