CVE-2024-28088: Langchain Path Traversal Vulnerability
LOWCVE-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
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.
pip install langchain>=0.0.339
pip install langchain-core>=0.1.30
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
CVE-2024-28088 Affected Langchain Versions
2 component(s)| 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?
Which Langchain versions are affected?
What version fixes CVE-2024-28088?
Is langchain affected?
Is langchain-core affected?
What CWE is associated with CVE-2024-28088?
How can I check PyPI dependencies for CVE-2024-28088?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}