Skip to main content
CVE-2024-8309VulnerabilityPublished Updated

CVE-2024-8309: langchain-ai/langchain · Improper Neutralization of Special Elements used in an SQL Command

Affects langchain-ai/langchainSource CVE Database V5

0

Not known to be exploited · 13% EPSS · CVSS 4.9 Medium.

Data as of 26 Oct 2026, 06:26 UTC

CVSS 3.0 base score
4.9Medium
How severe the flaw is on the 0–10 CVSS scale.
EPSS
13.7% chance of exploitation in 30 days – higher than 96% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
CVSS:3.0/AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 29 Oct 2024

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponised: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq Mirage: no evidence on record.

    No attack traffic recorded by OffSeq Mirage sensors

A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 2026-10-26.

What to do

Affected software

ProductAffectedFixed in
PyPIlangchain-ai/langchainpkg:pypi/langchain-ai/langchainOther threatsAffected
  • =0.2.5
Fixed in–

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

1. Implement strict input validation and sanitization on all prompts and inputs to the GraphCypherQAChain to prevent injection of malicious SQL commands. 2. Employ parameterized queries or prepared statements within the langchain-ai/langchain codebase to avoid direct concatenation of user inputs into SQL commands. 3. Isolate database access privileges, ensuring the application runs with least privilege necessary to limit the impact of any injection. 4. Monitor database logs and application behavior for anomalous queries or unexpected data modifications indicative of exploitation attempts. 5. Use runtime application self-protection (RASP) or web application firewalls (WAF) configured to detect and block SQL injection patterns. 6. Segregate multi-tenant data strictly to prevent cross-tenant data leakage. 7. Stay updated on vendor patches or advisories and apply them promptly once available. 8. Conduct security code reviews and penetration testing focusing on prompt injection vectors in AI workflows.

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.

References

Community reviews

Loading reviews…