CVE-2024-5998: Langchain community LangChain Pickle Deserialization Of Untrusted Vulnerability

HIGH
Advisory Identifier: GHSA-f2jm-rw3h-6phg
CVSS 5.2
CWE-502
Published
Advisory Summary

CVE-2024-5998 is a HIGH (CVSS 5.2) langchain pickle deserialization of untrusted vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Langchain community libraries in the PyPI ecosystem. The issue involves langchain pickle deserialization of untrusted data. Remediation is available by upgrading affected packages to version 0.2.4.

CVE-2024-5998 at a Glance

CVE Identifier CVE-2024-5998
GHSA Identifier GHSA-f2jm-rw3h-6phg
Severity HIGH
CVSS v3.1 Base Score 5.2
CWE Classification CWE-502: Deserialization of Untrusted Data
Affected Product Langchain community
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:P/AC:L/PR:L/UI:R/S:U/C:H/I:L/A:L).

Attack Vector Physical (AV:P)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2024-5998

To remediate this vulnerability, upgrade all affected Langchain community dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

langchain-community fixed: 0.2.4
pip install langchain-community>=0.2.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show langchain-community

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2024-5998, inspect your installed packages using pip:

pip show langchain-community

Analyze the terminal output to locate any version of Langchain community in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.2.4), your application is affected.

Note: The pip show langchain-community command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-502: Deserialization of Untrusted Data, where the product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. In Langchain community, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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.

CVE-2024-5998 Affected Langchain community Versions

1 component(s)
Fixed Versions:
0.2.4
Product / Package Ecosystem Affected Versions Fixed Version
langchain-community
PyPI
< 0.2.4
0.2.4

References

Frequently Asked Questions

What is CVE-2024-5998?
CVE-2024-5998 is a security vulnerability in Langchain community involving LangChain pickle deserialization of untrusted data under CWE-502: Deserialization of Untrusted Data.
Which Langchain community versions are affected?
Affected versions include releases prior to 0.2.4 across affected packages: langchain-community.
What version fixes CVE-2024-5998?
Upgrading to 0.2.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is langchain-community affected?
Yes, langchain-community is affected in releases prior to 0.2.4. Upgrade your dependency to 0.2.4 or later.
What is the CVSS score of CVE-2024-5998?
CVE-2024-5998 has a CVSS v3.1 base score of 5.2 (HIGH) with vector string CVSS:3.1/AV:P/AC:L/PR:L/UI:R/S:U/C:H/I:L/A:L.
What CWE is associated with CVE-2024-5998?
CVE-2024-5998 is classified under CWE-502: Deserialization of Untrusted Data (The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.).
How can I check PyPI dependencies for CVE-2024-5998?
Run the dependency tree command: 'pip show langchain-community'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-f2jm-rw3h-6phg",
  "modified" : "2025-07-30T19:30:02Z",
  "published" : "2024-09-17T12:30:32Z",
  "aliases" : [ "CVE-2024-5998" ],
  "summary" : "LangChain pickle deserialization of untrusted data",
  "details" : "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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:P/AC:L/PR:L/UI:R/S:U/C:H/I:L/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:A/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "langchain-community"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.2.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-5998"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/langchain-ai/langchain/commit/604dfe2d99246b0c09f047c604f0c63eafba31e7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/langchain-ai/langchain/commit/77209f315efd13442ec51c67719ba37dfaa44511"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/langchain-ai/langchain"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.com/bounties/fa3a2753-57c3-4e08-a176-d7a3ffda28fe"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-502" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-09-17T21:23:31Z",
    "nvd_published_at" : "2024-09-17T12:15:02Z"
  }
}