CVE-2024-7042: @langchain/community SQL Injection Vulnerability
LOWCVE-2024-7042 is a LOW (CVSS 4.9) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting @langchain/community libraries in the npm ecosystem. The issue involves @langchain/community sql injection vulnerability. Remediation is available by upgrading affected packages to version 0.3.3.
CVE-2024-7042 at a Glance
Security Impact
CVSS: 4.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L).
How to Fix CVE-2024-7042
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.
npm install @langchain/community@0.3.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @langchain/community
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-7042, inspect your project dependencies using npm:
npm ls @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.3.3), your application is affected.
Note: The npm ls @langchain/community command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. 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-7042 Affected @langchain/community Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@langchain/community
|
npm |
< 0.3.3
|
0.3.3
|
References
Frequently Asked Questions
What is CVE-2024-7042?
Which @langchain/community versions are affected?
What version fixes CVE-2024-7042?
Is @langchain/community affected?
What is the CVSS score of CVE-2024-7042?
What CWE is associated with CVE-2024-7042?
How can I check npm dependencies for CVE-2024-7042?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-6m59-8fmv-m5f9",
"modified" : "2024-11-01T13:16:11Z",
"published" : "2024-10-29T15:32:05Z",
"aliases" : [ "CVE-2024-7042" ],
"summary" : "@langchain/community SQL Injection vulnerability",
"details" : "A vulnerability in the GraphCypherQAChain class of langchain-ai/langchainjs versions 0.2.5 and all versions with this class allows for prompt injection, leading to SQL injection. This vulnerability permits unauthorized data manipulation, data exfiltration, denial of service (DoS) by deleting all data, breaches in multi-tenant security environments, and data integrity issues. Attackers can create, update, or delete nodes and relationships without proper authorization, extract sensitive data, disrupt services, access data across different tenants, and compromise the integrity of the database.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@langchain/community"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.3.3"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-7042"
}, {
"type" : "WEB",
"url" : "https://github.com/langchain-ai/langchainjs/commit/615b9d9ab30a2d23a2f95fb8d7acfdf4b41ad7a6"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/langchain-ai/langchainjs"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/langchain/PYSEC-2024-114.yaml"
}, {
"type" : "WEB",
"url" : "https://huntr.com/bounties/b612defb-1104-4fff-9fef-001ab07c7b2d"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-89" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2024-10-29T19:38:29Z",
"nvd_published_at" : "2024-10-29T13:15:08Z"
}
}