CVE-2024-3095: Langchain community Server-Side Request Forgery Vulnerability

MODERATE
Advisory Identifier: GHSA-q25c-c977-4cmh
CVSS 4.8
CWE-918
Published
Advisory Summary

CVE-2024-3095 is a MODERATE (CVSS 4.8) server-side request forgery vulnerability (CWE-918: Server-Side Request Forgery (SSRF)) affecting Langchain community libraries in the PyPI ecosystem. The issue involves server-side request forgery in langchain-community.retrievers.web_research.webresearchretriever. Remediation is available by upgrading affected packages to version 0.2.9.

CVE-2024-3095 at a Glance

CVE Identifier CVE-2024-3095
GHSA Identifier GHSA-q25c-c977-4cmh
Severity MODERATE
CVSS v3.1 Base Score 4.8
CWE Classification CWE-918: Server-Side Request Forgery (SSRF)
Affected Product Langchain community
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 4.8

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

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

How to Fix CVE-2024-3095

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.9
pip install langchain-community>=0.2.9
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-3095, 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.9), 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-918: Server-Side Request Forgery (SSRF), where the web server receives a url or similar request from an upstream component and retrieves the contents of this url, but it does not sufficiently ensure that the request is being sent to the expected destination. 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 Server-Side Request Forgery (SSRF) vulnerability exists in the Web Research Retriever component in langchain-community (langchain-community.retrievers.web_research.WebResearchRetriever). The vulnerability arises because the Web Research Retriever does not restrict requests to remote internet addresses, allowing it to reach local addresses. This flaw enables attackers to execute port scans, access local services, and in some scenarios, read instance metadata from cloud environments. The vulnerability is particularly concerning as it can be exploited to abuse the Web Explorer server as a proxy for web attacks on third parties and interact with servers in the local network, including reading their response data. This could potentially lead to arbitrary code execution, depending on the nature of the local services. The vulnerability is limited to GET requests, as POST requests are not possible, but the impact on confidentiality, integrity, and availability is significant due to the potential for stolen credentials and state-changing interactions with internal APIs. The patched code: * Requires users to opt-in * Suggests using a proxy to prevent requests to local addresses

CVE-2024-3095 Affected Langchain community Versions

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

References

Frequently Asked Questions

What is CVE-2024-3095?
CVE-2024-3095 is a security vulnerability in Langchain community involving Server-Side Request Forgery in langchain-community.retrievers.web_research.WebResearchRetriever under CWE-918: Server-Side Request Forgery (SSRF).
Which Langchain community versions are affected?
Affected versions include releases prior to 0.2.9 across affected packages: langchain-community.
What version fixes CVE-2024-3095?
Upgrading to 0.2.9 (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.9. Upgrade your dependency to 0.2.9 or later.
What is the CVSS score of CVE-2024-3095?
CVE-2024-3095 has a CVSS v3.1 base score of 4.8 (MODERATE) with vector string CVSS:3.0/AV:P/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N.
What CWE is associated with CVE-2024-3095?
CVE-2024-3095 is classified under CWE-918: Server-Side Request Forgery (SSRF) (The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.).
How can I check PyPI dependencies for CVE-2024-3095?
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-q25c-c977-4cmh",
  "modified" : "2024-07-24T17:34:39Z",
  "published" : "2024-06-06T21:30:36Z",
  "aliases" : [ "CVE-2024-3095" ],
  "summary" : "Server-Side Request Forgery in langchain-community.retrievers.web_research.WebResearchRetriever",
  "details" : "A Server-Side Request Forgery (SSRF) vulnerability exists in the Web Research Retriever component in langchain-community (langchain-community.retrievers.web_research.WebResearchRetriever). The vulnerability arises because the Web Research Retriever does not restrict requests to remote internet addresses, allowing it to reach local addresses. This flaw enables attackers to execute port scans, access local services, and in some scenarios, read instance metadata from cloud environments. The vulnerability is particularly concerning as it can be exploited to abuse the Web Explorer server as a proxy for web attacks on third parties and interact with servers in the local network, including reading their response data. This could potentially lead to arbitrary code execution, depending on the nature of the local services. The vulnerability is limited to GET requests, as POST requests are not possible, but the impact on confidentiality, integrity, and availability is significant due to the potential for stolen credentials and state-changing interactions with internal APIs.\n\nThe patched code:\n* Requires users to opt-in\n* Suggests using a proxy to prevent requests to local addresses",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:P/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "langchain-community"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.2.9"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-3095"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/langchain-ai/langchain/pull/24451"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/langchain-ai/langchain/commit/604dfe2d99246b0c09f047c604f0c63eafba31e7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/langchain-ai/langchain"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/langchain-ai/langchain/releases/tag/langchain-community%3D%3D0.2.9"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.com/bounties/e62d4895-2901-405b-9559-38276b6a5273"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-918" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-06-06T22:41:06Z",
    "nvd_published_at" : "2024-06-06T19:15:59Z"
  }
}