CVE-2024-5998: LangChain pickle deserialization of untrusted data
FAISS.deserialize_from_bytes in langchain-community before 0.2.4 unpickles the bytes it is given. If those bytes come from an untrusted source, loading them can run arbitrary commands such as os.system. Version 0.2.4 makes the call fail unless the caller opts in with allow_dangerous_deserialization=True.
Published Sep 17, 2024 · Updated Jul 30, 2025 · Analysis Nov 1, 2026
What an attacker can do
FAISS.deserialize_from_bytes rebuilds a vector store from a serialized byte string, and the docstore part of that data is a Python pickle. Pickle can instantiate arbitrary objects during loading, so a crafted payload runs code as soon as it is deserialized (CWE-502). The advisory names os.system as the example.
The attacker must get their bytes into the call. That happens when an app loads a stored index from a shared bucket, a database column, an upload or a download. The CVSS 3.1 vector reflects a local user with some privileges and user interaction, while the 4.0 vector reflects a network attack that needs the victim to load the data. The code runs with the privileges of the Python process, so it can read API keys and files and reach internal services.
Retrieval-augmented generation apps that share prebuilt indexes between users or teams are the typical exposure. An index you built and stored yourself, in a place only you can write, is not.
Who is affected
The pip package langchain-community, versions below 0.2.4, for code that calls FAISS.deserialize_from_bytes on data it does not fully control. Check the installed version:
pip show langchain-communityThen search your code for deserialize_from_bytes.
langchain-community
- Ecosystem
- PyPI
- Affected
- < 0.2.4
- Fixed in
- 0.2.4
- Check
pip show langchain-community
How to fix it
Upgrade to langchain-community 0.2.4 or later.
pip install --upgrade "langchain-community>=0.2.4"The fix, commit 77209f315efd13442ec51c67719ba37dfaa44511, adds a keyword-only parameter allow_dangerous_deserialization, default False. The method raises a ValueError unless you pass True. Pass True only when you trust the source of the bytes, and prefer to rebuild indexes from source documents.
How to tell if you were hit
Search your code for deserialize_from_bytes and for allow_dangerous_deserialization=True and trace where the bytes come from. Review the storage that holds serialized indexes for recent writes from untrusted accounts. On hosts, look for child processes spawned by the Python process that loads indexes.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
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 versions prior to 0.2.4.
Credited to BarrensZeppelin.
Questions
- Why does my code now raise a ValueError on deserialize_from_bytes?
From 0.2.4 the method refuses to load pickle data unless you pass allow_dangerous_deserialization=True. Set it only if you trust where the bytes come from.
- Which package carries the fix?
langchain-community 0.2.4. The vulnerable function lives in langchain_community, not the core langchain package.
- Is this exploited in the wild?
No source reports exploitation, and it is not in CISA's KEV catalog.
References
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. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. 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
