CVE-2024-3571 Path Traversal in langchain-ai/langchain
Attackers can read or write arbitrary files via path traversal in LocalFileStore, potentially leading to information disclosure or remote code execution.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-3571?
CVE-2024-3571 is a medium-severity path traversal vulnerability in langchain-ai/langchain, published on 16 Apr 2024. Any signed-in user can exploit it over the network, with no action from the victim.
Official description
langchain-ai/langchain is vulnerable to path traversal due to improper limitation of a pathname to a restricted directory ('Path Traversal') in its LocalFileStore functionality. An attacker can leverage this vulnerability to read or write files anywhere on the filesystem, potentially leading to information disclosure or remote code execution. The issue lies in the handling of file paths in the mset and mget methods, where user-supplied input is not adequately sanitized, allowing directory traversal sequences to reach unintended directories.
Weakness: CWE-22
Which versions are affected by CVE-2024-3571?
3 open source packages ship an affected version, including langchain. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
langchain PyPI | All versions | 0.0.353 |
langchain PyPI | All versions | 0.0.353 |
langchain PyPI | All versions | 0.0.353 |
Products include Langchain Langchain.
How do I fix CVE-2024-3571?
Upgrade langchain to 0.0.353 or later.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2024-3571 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-3571 exists.
Other vulnerabilities in langchain-ai/langchain
- CVE-2023-39631 Langchain vulnerable to arbitrary code execution via the evaluate function in the numexpr library
- CVE-2023-36281 langchain vulnerable to arbitrary code execution
- CVE-2023-38860 LangChain vulnerable to arbitrary code execution
- CVE-2023-38896 LangChain vulnerable to arbitrary code execution
- CVE-2023-39659 LangChain vulnerable to arbitrary code execution
Sources
Also known as GHSA-rgp8-pm28-3759, PYSEC-2026-1510.