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

08/03/2023
by   Rodrigo Pedro, et al.
0

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_2SQL) injections targeting web applications based on the Langchain framework. Using Langchain as our case study, we characterize P_2SQL 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_2SQL attacks across language models. Our findings indicate that LLM-integrated applications based on Langchain are highly susceptible to P_2SQL 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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
05/24/2020

DeepSQLi: Deep Semantic Learning for Testing SQL Injection

Security is unarguably the most serious concern for Web applications, to...
research
01/08/2021

Simulating SQL Injection Vulnerability Exploitation Using Q-Learning Reinforcement Learning Agents

In this paper, we propose a first formalization of the process of exploi...
research
01/09/2019

Fuzzy neural networks to create an expert system for detecting attacks by SQL Injection

Its constant technological evolution characterizes the contemporary worl...
research
05/02/2021

Spinner: Automated Dynamic Command Subsystem Perturbation

Injection attacks have been a major threat to web applications. Despite ...
research
05/11/2021

An Innovative Security Strategy using Reactive Web Application Honeypot

Nowadays, web applications have become most prevalent in the industry, a...
research
02/23/2023

More than you've asked for: A Comprehensive Analysis of Novel Prompt Injection Threats to Application-Integrated Large Language Models

We are currently witnessing dramatic advances in the capabilities of Lar...
research
06/12/2022

Evolutionary Multi-Task Injection Testing on Web Application Firewalls

Web application firewall (WAF) plays an integral role nowadays to protec...

Please sign up or login with your details

Forgot password? Click here to reset