Cyber Resilience

CVE-2024-8309

SQLi in Langchain 0.2.5

Public PoCSQLi
Published
29 October 2024
Modified
01 November 2024
Patch / advisory
CVSS Score v3.1 9.8
Click a component to see what it means
Raw vectorCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS Score 0.14 96th percentile
Risk Priority 82 floored blend · peak EPSS

Summary

CVE-2024-8309 is a critical-severity SQL Injection (CWE-89) vulnerability in Langchain Langchain. Its CVSS base score is 9.8 (Critical).

Operationally, exploitation aligns with the MITRE ATT&CK technique Exploit Public-Facing Application (T1190); ranked in the top 4% of CVEs by exploit likelihood; it is not currently listed in the CISA KEV catalog; a public proof-of-concept is referenced.

This vulnerability is AI-related — categorised as LLM Application Platforms; in the LLM/Generative AI Risks risk domain.

The strongest mitigations our analysis identified map to SA-11 (Developer Testing and Evaluation) and SI-10 (Information Input Validation) — see the control section below for these in your framework.

OWASP Top 10 for Web (2025)

EU & UK References

Vulnerability Data

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,…

more

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.

CWE(s)

AI Security AnalysisAI

AI Category
LLM Application Platforms
Risk Domain
LLM/Generative AI Risks
OWASP Top 10 for LLMs 2025
None mapped
AI-specific weaknesses CR
  • CWE-1427 — Prompt injection (1427) feeds untrusted input to LLM; generated Cypher reaches DB sink unvalidated (1426).
Mapped by Cyber Resilience · not in NVD. Poisoning and extraction cases are routed to MITRE ATLAS instead of a synthetic CWE.
Classification Reason
The vulnerability is in LangChain's GraphCypherQAChain, a component for integrating LLMs with graph databases (e.g., Neo4j) to generate Cypher queries from natural language, which is part of AI agent and tool integration frameworks.

Related Threats

MITRE ATT&CK Enterprise Techniques

T1190 Exploit Public-Facing Application Initial Access
Adversaries may attempt to exploit a weakness in an Internet-facing host or system to initially access a network.
T1221 Template Injection Stealth
Adversaries may create or modify references in user document templates to conceal malicious code or force authentication attempts.
T1659 Content Injection Initial Access
Adversaries may gain access and continuously communicate with victims by injecting malicious content into systems through online network traffic.
T1674 Input Injection Execution
Adversaries may simulate keystrokes on a victim’s computer by various means to perform any type of action on behalf of the user, such as launching the command interpreter using keyboard shortcuts, typing an inline script to be executed,…
T1059 Command and Scripting Interpreter Execution
Adversaries may abuse command and script interpreters to execute commands, scripts, or binaries.
T1059.001 PowerShell Execution
Adversaries may abuse PowerShell commands and scripts for execution.
Derived from this CVE’s CWE(s) via the direct CWE→ATT&CK cross-walk.

CVEs Like This One

CVE-2023-36189Same product: Langchain Langchain
CVE-2024-7042Same product: Langchain Langchain
CVE-2024-2777Shared CWE-74, CWE-89
CVE-2024-10947Shared CWE-74, CWE-89
CVE-2024-2769Shared CWE-74, CWE-89
CVE-2023-1059Shared CWE-74, CWE-89
CVE-2023-5269Shared CWE-74, CWE-89
CVE-2024-7219Shared CWE-74, CWE-89
CVE-2023-7096Shared CWE-74, CWE-89
CVE-2024-7221Shared CWE-74, CWE-89

Affected Assets

langchain
langchain
0.2.5

Mitigating Controls

Control response

Prevent
Stop it (NIST 800-53)

Detect
Catch it (NIST detect / respond)

Harden
Shrink the surface (DISA STIG)

Validate
Prove the fix (OWASP ASVS)
  • V1.2.1
  • V1.2.3
  • V1.2.5
  • V1.2.8

Mitigating Controls (NIST 800-53 r5) AI

Developer testing and evaluation can discover SQLi flaws before deployment but does not stop their introduction.

Input validation directly stops untrusted data from reaching SQL query construction without neutralization.

Secure engineering principles require parameterized queries and input sanitization that structurally eliminate SQLi.

System monitoring can identify attempted SQLi exploitation via anomalous queries after the weakness exists.

Mitigating Controls (NIST CSF 2.0) AI

Derived directly from the weakness types (CWEs) cited in the NVD entry via our AI-authored CWE→CSF cross-walk (authority under review) — links open the control.

PR.PS-06 mostly match
prevents

Secure SDLC practices directly target injection flaws during coding and review so largely prevent CWE-89 introduction, yet the single broad outcome leaves residual risk from incomplete neutralization techniques or missed edge cases.

PR.AT-02 partial match
prevents

Training raises developer awareness of SQLi risks and can reduce introduction likelihood (partial) but removes none of the actual coding flaw's risk by itself since technical neutralization is still required.

Mitigating Controls (ISO/IEC 27001:2022 Annex A) AI

Derived directly from the weakness types (CWEs) cited in the NVD entry via our AI-authored CWE→ISO cross-walk (authority under review) — links open the control.

finds

The same secure-coding and static-analysis activities surface missing neutralization of SQL metacharacters before the system is accepted.

prevents

Early warnings and shared best-practice information help organizations apply the latest remediation techniques against SQL-injection vulnerabilities.

prevents

Threat-intelligence feeds that surface new SQL-injection campaigns enable rapid updates to query-construction defenses and detection signatures before exploitation occurs.

A.8.15 Logging partial match
finds

Logging supports detection of injection attempts but does not prevent the weakness.

finds

Monitoring activities can identify active injection attacks after they occur.

prevents

Secure-coding rules and security testing phases mandate the use of parameterized queries or equivalent escaping, preventing the construction of dynamic SQL statements from untrusted input.

References