Skip to content
RCE Disclosed report Intermediate CVE-2024-5998

LangChain pickle deserialization of untrusted data

The FAISS.deserialize_from_bytes function in LangChain deserialises untrusted data using pickle, which can lead to arbitrary command execution. An attacker could exploit this to run commands via os.system.

langchain-ai/langchain

Originally disclosed on huntr

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.

From the GitHub Advisory Database (GHSA-f2jm-rw3h-6phg, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the function uses Python's pickle module to deserialise data without validating its origin or content, allowing arbitrary code execution.

Impact

An attacker could execute arbitrary commands on the system running the vulnerable code.

What the attacker needed

Ability to supply untrusted data to deserialize_from_bytes

The fix

The issue was fixed in version 0.2.4.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Pickle is a Python way to save and load objects, but loading a pickle from an untrusted source can run harmful code. Here, a function that loads such data doesn't check if it's safe, so an attacker could make it run commands on the machine.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More from langchain-ai/langchain

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.