CVE-2024-5998 Deserialization of Untrusted Data in langchain-ai/langchain
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.
| Package | Affected | Fixed in |
|---|---|---|
langchain-community PyPI | All versions | 0.2.4 |
langchain-community PyPI | All versions | 0.2.4 |
langchain-community PyPI | All versions | 0.2.4 |
langchain PyPI | All versions | 0.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.
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-f2jm-rw3h-6phg, PYSEC-2024-323, PYSEC-2026-1514.