CVE-2024-5998 Deserialization of Untrusted Data in langchain-ai/langchain

Medium 5.2 Published Updated

Attackers can execute arbitrary commands via unsafe pickle deserialization in the FAISS module of the LangChain library.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2024-5998?

CVE-2024-5998 is a medium-severity unsafe deserialization vulnerability in langchain-ai/langchain, published on 17 Sep 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official description

A vulnerability in the FAISS.deserialize_from_bytes function of langchain-ai/langchain allows for pickle deserialization of untrusted data. This can lead to the execution of arbitrary commands via the os.system function. The issue affects the latest version of the product.

Weakness: CWE-502

Which versions are affected by CVE-2024-5998?

4 open source packages ship an affected version, including langchain-community and langchain. It affects 1 product.

PackageAffectedFixed in
langchain-community PyPIAll versions0.2.4
langchain-community PyPIAll versions0.2.4
langchain-community PyPIAll versions0.2.4
langchain PyPIAll versions0.2.9

Products include Langchain Langchain.

How do I fix CVE-2024-5998?

Upgrade langchain-community to 0.2.4 or later.

Upgrade, and only deserialise data from trusted sources or with an allow-list of types. More about Unsafe deserialization.

Is CVE-2024-5998 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-5998 exists.

Sources

Also known as GHSA-f2jm-rw3h-6phg, PYSEC-2024-323, PYSEC-2026-1514.

Is CVE-2024-5998 in your software?

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

Check your SBOMs for free