CVE-2024-28088: Langchain Path Traversal Vulnerability

LOW
Advisory Identifier: GHSA-h59x-p739-982c
Published
Advisory Summary

CVE-2024-28088 is a LOW path traversal vulnerability (General Security Weakness) affecting Langchain libraries in the PyPI ecosystem. The issue involves langchain directory traversal vulnerability. Remediation is available by upgrading affected packages to version 0.0.339, 0.1.30.

CVE-2024-28088 at a Glance

CVE Identifier CVE-2024-28088
GHSA Identifier GHSA-h59x-p739-982c
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Langchain
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2024-28088

To remediate this vulnerability, upgrade all affected Langchain 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 fixed: 0.0.339
pip install langchain>=0.0.339
langchain-core fixed: 0.1.30
pip install langchain-core>=0.1.30
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

How to Check if You Are Affected

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

pip show langchain

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In Langchain, 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

LangChain through 0.1.10 allows ../ directory traversal by an actor who is able to control the final part of the path parameter in a load_chain call. This bypasses the intended behavior of loading configurations only from the hwchase17/langchain-hub GitHub repository. The outcome can be disclosure of an API key for a large language model online service, or remote code execution.

CVE-2024-28088 Affected Langchain Versions

2 component(s)
Fixed Versions:
0.0.3390.1.30
Product / Package Ecosystem Affected Versions Fixed Version
langchain
PyPI
< 0.0.339
0.0.339
langchain-core
PyPI
< 0.1.30
0.1.30

References

Frequently Asked Questions

What is CVE-2024-28088?
CVE-2024-28088 is a security vulnerability in Langchain involving LangChain directory traversal vulnerability under General Security Weakness.
Which Langchain versions are affected?
Affected versions include releases prior to 0.0.339, 0.1.30 across affected packages: langchain, langchain-core.
What version fixes CVE-2024-28088?
Upgrading to 0.0.339, 0.1.30 (or the latest patched release for your respective branch) resolves the vulnerability.
Is langchain affected?
Yes, langchain is affected in releases prior to 0.0.339. Upgrade your dependency to 0.0.339 or later.
Is langchain-core affected?
Yes, langchain-core is affected in releases prior to 0.1.30. Upgrade your dependency to 0.1.30 or later.
What CWE is associated with CVE-2024-28088?
CVE-2024-28088 is classified under General Security Weakness.
How can I check PyPI dependencies for CVE-2024-28088?
Run the dependency tree command: 'pip show langchain'. 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-h59x-p739-982c",
  "modified" : "2024-03-14T23:14:54Z",
  "published" : "2024-03-04T00:30:53Z",
  "aliases" : [ "CVE-2024-28088" ],
  "summary" : "LangChain directory traversal vulnerability",
  "details" : "LangChain through 0.1.10 allows ../ directory traversal by an actor who is able to control the final part of the path parameter in a load_chain call. This bypasses the intended behavior of loading configurations only from the hwchase17/langchain-hub GitHub repository. The outcome can be disclosure of an API key for a large language model online service, or remote code execution.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "langchain"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.339"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "langchain-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.1.30"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-28088"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/langchain-ai/langchain/pull/18600"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/langchain-ai/langchain/commit/e1924b3e93d513ca950c72f8e80e1c133749fba5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/PinkDraconian/PoC-Langchain-RCE/blob/main/README.md"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/langchain-ai/langchain"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/langchain-ai/langchain/blob/f96dd57501131840b713ed7c2e86cbf1ddc2761f/libs/core/langchain_core/utils/loading.py"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/langchain-core/PYSEC-2024-45.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/langchain/PYSEC-2024-43.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-06T16:13:39Z",
    "nvd_published_at" : "2024-03-04T00:15:47Z"
  }
}