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

@langchain/community SQL Injection vulnerability

The GraphCypherQAChain class in langchainjs versions 0.2.5 and all versions with this class is vulnerable to prompt injection that leads to SQL injection. An attacker could manipulate, exfiltrate, or delete data, breach multi-tenant isolation, and compromise database integrity.

langchain-ai/langchainjs

Originally disclosed on huntr

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.

From the GitHub Advisory Database (GHSA-6m59-8fmv-m5f9, 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 AI-generated queries, allowing prompt injection to produce arbitrary SQL.

Impact

Attackers could create, update, or delete nodes and relationships without authorisation, extract sensitive data, cause denial of service by deleting all data, access data across tenants, and compromise database integrity.

What the attacker needed

Use of GraphCypherQAChain; ability to supply input 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 security flaw in a tool that lets an AI model talk to a database. Because the AI can be tricked by malicious instructions (prompt injection), an attacker can make it run harmful database commands (SQL injection). 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/langchainjs

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.