CVE-2024-3571 Path Traversal in langchain-ai/langchain

Medium 6.5 Published Updated

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.

PackageAffectedFixed in
langchain PyPIAll versions0.0.353
langchain PyPIAll versions0.0.353
langchain PyPIAll versions0.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.

Sources

Also known as GHSA-rgp8-pm28-3759, PYSEC-2026-1510.

Is CVE-2024-3571 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free