CVE-2024-3095: Langchain community Server-Side Request Forgery Vulnerability
MODERATECVE-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
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).
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.
pip install langchain-community>=0.2.9
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
CVE-2024-3095 Affected Langchain community Versions
1 component(s)| 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?
Which Langchain community versions are affected?
What version fixes CVE-2024-3095?
Is langchain-community affected?
What is the CVSS score of CVE-2024-3095?
What CWE is associated with CVE-2024-3095?
How can I check PyPI dependencies for CVE-2024-3095?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}