CVE-2024-10940: Langchain core Langchain-core Allows Unauthorized Users To Vulnerability

MODERATE
Advisory Identifier: GHSA-5chr-fjjv-38qv
CVSS 5.3
CWE-497
Published
Advisory Summary

CVE-2024-10940 is a MODERATE (CVSS 5.3) langchain-core allows unauthorized users to vulnerability (CWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere) affecting Langchain core libraries in the PyPI ecosystem. The issue involves langchain-core allows unauthorized users to read arbitrary files from the host file system. Remediation is available by upgrading affected packages to version 0.1.53, 0.2.43, 0.3.15.

CVE-2024-10940 at a Glance

CVE Identifier CVE-2024-10940
GHSA Identifier GHSA-5chr-fjjv-38qv
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere
Affected Product Langchain core
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.3

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2024-10940

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

How to Check if You Are Affected

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

pip show langchain-core

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere, where the product does not properly prevent sensitive system-level information from being accessed by unauthorized actors who do not have the same level of access to the underlying system as the product does. In Langchain core, 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 langchain-core versions >=0.1.17,<0.1.53, >=0.2.0,<0.2.43, and >=0.3.0,<0.3.15 allows unauthorized users to read arbitrary files from the host file system. The issue arises from the ability to create langchain_core.prompts.ImagePromptTemplate's (and by extension langchain_core.prompts.ChatPromptTemplate's) with input variables that can read any user-specified path from the server file system. If the outputs of these prompt templates are exposed to the user, either directly or through downstream model outputs, it can lead to the exposure of sensitive information.

CVE-2024-10940 Affected Langchain core Versions

3 component(s)
Fixed Versions:
0.1.530.2.430.3.15
Product / Package Ecosystem Affected Versions Fixed Version
langchain-core
PyPI
≥ 0.1.17
< 0.1.53
0.1.53
langchain-core
PyPI
≥ 0.2.0
< 0.2.43
0.2.43
langchain-core
PyPI
≥ 0.3.0
< 0.3.15
0.3.15

References

Frequently Asked Questions

What is CVE-2024-10940?
CVE-2024-10940 is a security vulnerability in Langchain core involving langchain-core allows unauthorized users to read arbitrary files from the host file system under CWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere.
Which Langchain core versions are affected?
Affected versions include releases prior to 0.1.53, 0.2.43, 0.3.15 across affected packages: langchain-core.
What version fixes CVE-2024-10940?
Upgrading to 0.1.53, 0.2.43, 0.3.15 (or the latest patched release for your respective branch) resolves the vulnerability.
Is langchain-core affected?
Yes, langchain-core is affected in releases prior to 0.1.53, 0.2.43, 0.3.15. Upgrade your dependency to 0.1.53, 0.2.43, 0.3.15 or later.
What is the CVSS score of CVE-2024-10940?
CVE-2024-10940 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2024-10940?
CVE-2024-10940 is classified under CWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere (The product does not properly prevent sensitive system-level information from being accessed by unauthorized actors who do not have the same level of access to the underlying system as the product does.).
How can I check PyPI dependencies for CVE-2024-10940?
Run the dependency tree command: 'pip show langchain-core'. 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-5chr-fjjv-38qv",
  "modified" : "2025-05-20T18:18:37Z",
  "published" : "2025-03-20T12:32:41Z",
  "aliases" : [ "CVE-2024-10940" ],
  "summary" : "langchain-core allows unauthorized users to read arbitrary files from the host file system",
  "details" : "A vulnerability in langchain-core versions >=0.1.17,<0.1.53, >=0.2.0,<0.2.43, and >=0.3.0,<0.3.15 allows unauthorized users to read arbitrary files from the host file system. The issue arises from the ability to create langchain_core.prompts.ImagePromptTemplate's (and by extension langchain_core.prompts.ChatPromptTemplate's) with input variables that can read any user-specified path from the server file system. If the outputs of these prompt templates are exposed to the user, either directly or through downstream model outputs, it can lead to the exposure of sensitive information.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "langchain-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.1.17"
      }, {
        "fixed" : "0.1.53"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "langchain-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.2.0"
      }, {
        "fixed" : "0.2.43"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "langchain-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.3.0"
      }, {
        "fixed" : "0.3.15"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-10940"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/langchain-ai/langchain/commit/7d481f10102f43559cc57bcad7eba291067939ee"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/langchain-ai/langchain/commit/c1e742347f9701aadba8920e4d1f79a636e50b68"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/langchain-ai/langchain/commit/e711034713259ae448981bc0fd1d7a5671499c31"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/langchain-ai/langchain"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.com/bounties/be1ee1cb-2147-4ff4-a57b-b6045271cf27"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-497" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-03-21T16:43:25Z",
    "nvd_published_at" : "2025-03-20T10:15:21Z"
  }
}