Skip to content
SQL injection Disclosed report Intermediate CVE-2024-8309

Langchain SQL Injection vulnerability

The GraphCypherQAChain class in langchain-ai/langchain version 0.2.5 is vulnerable to SQL injection through prompt injection. An attacker could manipulate, exfiltrate, or delete data, breach multi-tenant isolation, and compromise database integrity.

langchain-ai/langchain

Originally disclosed on huntr

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.

From the GitHub Advisory Database (GHSA-45pg-36p6-83v9, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the GraphCypherQAChain does not properly sanitise or constrain the Cypher queries generated from user prompts, allowing prompt injection to produce arbitrary database operations.

Impact

Attackers could create, update, or delete nodes and relationships without authorisation, extract sensitive data, disrupt services, access data across tenants, and compromise database integrity.

What the attacker needed

Access to a system using GraphCypherQAChain; ability to submit prompts to the chain

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

This is a flaw in a tool that lets an AI model talk to a graph database. Because the tool does not properly separate the AI's instructions from user input, a malicious user can trick the AI into running harmful database commands. That could let them read, change, or delete data they should not touch.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

More from langchain-ai/langchain

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.