CVE-2024-8309: langchain-ai langchain-ai/langchain SQL Injection
Vulnerability summary
CVE-2024-8309 is a critical (CVSS 9.8) SQL Injection vulnerability in langchain-ai langchain-ai/langchain. EPSS estimates a 13.74% chance of exploitation in the next 30 days, higher than 96.4% of scored vulnerabilities. 1 public exploit is recorded.
Timeline
- 29-10-2024PublishedVulnerability first disclosed.
- 15-10-2025Last modifiedVulnerability information updated.
Description
A vulnerability in the GraphCypherQAChain class of langchain-ai/langchain version 0.2.5 allows for SQL injection through prompt injection. This vulnerability can lead to 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.
CVSS metrics
5 scores · 3 sources · 3 versions- OSV · PypiEcosystem advisory · calculated4.9MediumCVSS:3.0/AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L
- NVDNIST4.9MediumCVSS:3.0/AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L
EPSS trend
Probability
13.74%
Chance of exploitation in the next 30 days
Percentile
96%
Versus all other CVEs
30-day change
0.00 pp
From 13.74% on 19-09-2026
Known exploited
Compare KEV catalogsNot in any of the 3 tracked catalogs.
Public exploits
1 foundExploit Reference (huntr.com)
Maturity: unknown
Weaknesses
CWE · root cause- CWE-89Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')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.
- CWE-74Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
Affected systems
PyPI2 products
- langchain< 0.2.0 | < c2a3021bb0c5f54649d380b42a0684ca5778c255
- langchain-community≥ 0.2.0, < 0.2.19 | ≥ 0.2.0, < 0.3.0
Langchain1 product
- langchain0.2.5
Langchain-ai1 product
- langchain-ai/langchain≥ unspecified, < 0.3.0
3 vendors · 4 products
References
8 links- pypi.org/project/langchainPACKAGE