paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Prompt-to-SQL Injections in LLM-Integrated Web Applications: Risks and Defenses

LLM 集成 Web 应用中的 Prompt-to-SQL 注入:风险与防御
ICSE 2025 IEEE/ACM 47th International Conference on Software Engineering (ICSE)2025匹配度 3/10 · 论文聚焦 LLM 集成 Web 应用中的 prompt-to-SQL 注入攻击与防御,属于安全与隐私方向,虽涉及 LLM 交互程序但未使用静态分析,也不涉及浮点/贝叶斯程序分析或 LLM 改进程序分析,与用户研究核心方向仅背景层面相关。引用 20 to_read
Rodrigo Pedro, Miguel E. Coimbra, Daniel Castro, Paulo Carreira, Nuno Santos
crossref: 2026-09-12

AI 速览

一句话:系统刻画了 prompt-to-SQL 注入攻击,评估七个 LLM 与五个真实应用的风险,并提出四种防御技术。

论文关注基于 LangChain、LlamaIndex 等中间件构建的 LLM 集成 Web 应用:用户 prompt 被翻译为 SQL 查询,而未净化的 prompt 可能导致 SQL 注入。作者系统性地刻画了 prompt-to-SQL(P2SQL)注入,通过多个具体实例分析其变体与对应用安全的影响。评估方面,作者测试了七种先进 LLM,表明 P2SQL 攻击在不同语言模型上普遍存在风险;并通过手工与自动化方法在五个真实应用中发现了 P2SQL 漏洞。结果表明 LLM 集成应用极易受到此类注入攻击,亟需健壮防御。为此,作者提出四种有效防御技术,可作为 LangChain 框架的扩展集成。

问题
LLM 集成 Web 应用中,未经净化的用户 prompt 被转换为 SQL 查询,可能引发 SQL 注入,威胁数据库安全。
方法
刻画 prompt-to-SQL 注入的变体与影响,用具体示例说明,并评估七种 LLM,同时以手工和自动化手段在五个真实应用中挖掘漏洞。
评估
通过七种 LLM 的攻击评估与五个真实应用的漏洞发现,验证 P2SQL 注入的高风险性,并据此提出四种可集成到 LangChain 的防御技术。
原文摘要(Abstract)

Large Language Models (LLMs) have found widespread applications in various domains, including web applications with chatbot interfaces. 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. In this paper, we present a comprehensive examination of prompt-to-SQL ($\mathbf{P}_{2} \mathbf{S Q L}$) injections targeting web applications based on frameworks such as LangChain and LlamaIndex. We characterize$\mathrm{P}_{2} \text{SQL}$injections, exploring their variants and impact on application security through multiple concrete examples. We evaluate seven state-of-the-art LLMs, demonstrating the risks of$P_{2}$SQL attacks across language models. By employing both manual and automated methods, we discovered$\mathrm{P}_{2} \text{SQL}$vulnerabilities in five real-world applications. Our findings indicate that LLMintegrated applications are highly susceptible to$\mathrm{P}_{2} \text{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.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot8767,
  title = {Prompt-to-SQL Injections in LLM-Integrated Web Applications: Risks and Defenses},
  author = {Rodrigo Pedro and Miguel E. Coimbra and Daniel Castro and Paulo Carreira and Nuno Santos},
  booktitle = {ICSE},
  year = {2025},
  doi = {10.1109/icse55347.2025.00007}
}