From Prompt Injections to SQL Injection Attacks: How Protected is Your LLM-Integrated Web Application?

AI-generated keywords: Prompt-to-SQL Injections

AI-generated Key Points

  • Prompt-to-SQL (P2SQL) injections pose significant security risks to Large Language Models (LLMs) integrated into web applications.
  • P2SQL attacks involve interactions between the LLM and the database, compromising data consistency, accessing confidential information, or injecting malicious data.
  • The study characterizes different attack types using various models within the Langchain framework and proposes four effective defense techniques as extensions to Langchain.
  • Experimental validation shows the efficacy of these defense techniques in mitigating specific attacks analyzed in the study.
  • Further research is needed to discover new vulnerabilities, propose novel defenses, reduce overheads, automate vulnerability exploration processes, and develop user-friendly frameworks for defending against P2SQL attacks.
Also access our AI generated: Comprehensive summary, Lay summary, Blog-like article; or ask questions about this paper to our AI assistant.

Authors: Rodrigo Pedro, Daniel Castro, Paulo Carreira, Nuno Santos

12 pages, 3 figures, 3 tables, 5 listings. 47th IEEE/ACM International Conference on Software Engineering (2025)
License: CC BY 4.0

Abstract: Large Language Models (LLMs) have found widespread applications in various domains, including web applications, where they facilitate human interaction via chatbots with natural language interfaces. Internally, aided by an LLM-integration middleware such as Langchain, user prompts are translated into SQL queries used by the LLM to provide meaningful responses to users. However, unsanitized user prompts can lead to SQL injection attacks, potentially compromising the security of the database. Despite the growing interest in prompt injection vulnerabilities targeting LLMs, the specific risks of generating SQL injection attacks through prompt injections have not been extensively studied. In this paper, we present a comprehensive examination of prompt-to-SQL (P$_2$SQL) injections targeting web applications based on the Langchain framework. Using Langchain as our case study, we characterize P$_2$SQL injections, exploring their variants and impact on application security through multiple concrete examples. Furthermore, we evaluate 7 state-of-the-art LLMs, demonstrating the pervasiveness of P$_2$SQL attacks across language models. Our findings indicate that LLM-integrated applications based on Langchain are highly susceptible to P$_2$SQL injection attacks, warranting the adoption of robust defenses. To counter these attacks, we propose four effective defense techniques that can be integrated as extensions to the Langchain framework. We validate the defenses through an experimental evaluation with a real-world use case application.

Submitted to arXiv on 03 Aug. 2023

Ask questions about this paper to our AI assistant

You can also chat with multiple papers at once here.

AI assistant instructions?

Results of the summarizing process for the arXiv paper: 2308.01990v4

, , , , This paper focuses on the attack vector of Prompt-to-SQL (P2SQL) injections, which pose significant security risks to Large Language Models (LLMs) integrated into web applications. These attacks involve interactions between the LLM and the database, potentially compromising data consistency, accessing confidential information, or injecting malicious data. The study delves deeper into the feasibility of P2SQL attacks by characterizing different attack types using various models within the Langchain framework. It presents a comprehensive examination of P2SQL injections targeting web applications and proposes four effective defense techniques as extensions to Langchain. Experimental validation showcases their efficacy in mitigating specific attacks analyzed in the study. However, there is room for further research focused on discovering new vulnerabilities, proposing novel defenses, reducing overheads, automating vulnerability exploration processes, and developing user-friendly frameworks for defending against P2SQL attacks. This research contributes valuable insights into safeguarding LLM-integrated web applications from prompt-to-SQL injection threats and emphasizes the importance of implementing robust security measures to protect databases from potential data destruction and confidentiality breaches.
Created on 03 Sep. 2025

Assess the quality of the AI-generated content by voting

Score: 0

Why do we need votes?

Votes are used to determine whether we need to re-run our summarizing tools. If the count reaches -10, our tools can be restarted.

Similar papers summarized with our AI tools

Navigate through even more similar papers through a

tree representation

Look for similar papers (in beta version)

By clicking on the button above, our algorithm will scan all papers in our database to find the closest based on the contents of the full papers and not just on metadata. Please note that it only works for papers that we have generated summaries for and you can rerun it from time to time to get a more accurate result while our database grows.

Disclaimer: The AI-based summarization tool and virtual assistant provided on this website may not always provide accurate and complete summaries or responses. We encourage you to carefully review and evaluate the generated content to ensure its quality and relevance to your needs.