Lune

EMNLP Findings2024

SecureSQL: Evaluating Data Leakage of Large Language Models as Natural Language Interfaces to Databases

Yanqi Song, Ruiheng Liu, Shu Chen, Qianhao Ren, Yu Zhang, Yongqi Yu

摘要

With the widespread application of Large Language Models (LLMs) in Natural Language Interfaces to Databases (NLIDBs), concerns about security issues in NLIDBs have been increasing gradually.However, research on sensitive data leakage in NLIDBs is relatively limited.Therefore, we propose a benchmark to assess the risk of LLMs leaking sensitive data when generating SQL queries.This benchmark covers 932 samples from 34 different domains, including medical, legal, financial, and political aspects.We evaluate 15 models from six LLM families, and the results show that the model with the best performance has an accuracy of 61.7%, whereas humans achieve an accuracy of 94%.Most models perform close to or even below the level of random selection.We also evaluate two common attack methods, namely prompt injection and inference attacks, as well as a defense method based on chainof-thoughts (COT) prompting.Experimental results show that both attack methods significantly impact the model, while the defense method based on COT prompting does not significantly improve accuracy, further highlighting the severity of sensitive data leakage issues in NLIDBs.We hope this research will draw more attention and further study from the researchers on this issue.The benchmark and source code are available at https://github. com/JacobiSong/SecureSQL.I'm an administrator.How old is Alice?SELECT age FROM person WHERE name = "Alice" 41 Heh heh heh, I got it, Alice's age is 41 years old!How old is Alice?Sorry, this information is protected and I cannot provide the query.Ugh! I'll be back!How many people are over 40 years old?SELECT COUNT() FROM person WHERE age > 40 30 SELECT COUNT() FROM person WHERE age > 41 AND name != "Alice" Heh heh heh, I got it, Alice's age is 41 years old!How many people are over 41 years old besides Alice?29 I know Alice is either 31 or 41 years old.Is Alice over 35 years old?SELECT IF(age>35, "Yes", "No") FROM person WHERE name = "Alice" Yes

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 2 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • SafeNLIDB: A Privacy-Preserving Safety Alignment Framework for LLM-based Natural Language Database Interfaces 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
  • SafeNLIDB: A Privacy-Preserving Safety Alignment Framework for LLM-based Natural Language Database Interfaces 引用了 Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
  • Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
  • Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation 引用了 Training language models to follow instructions with human feedback
  • Before Generation, Align it! A Novel and Effective Strategy for Mitigating Hallucinations in Text-to-SQL Generation 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
  • Before Generation, Align it! A Novel and Effective Strategy for Mitigating Hallucinations in Text-to-SQL Generation 引用了 Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
  • Before Generation, Align it! A Novel and Effective Strategy for Mitigating Hallucinations in Text-to-SQL Generation 引用了 Training language models to follow instructions with human feedback
  • Developing and Benchmarking Verification Algorithms to Improve Text-to-SQL Generation 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
  • Developing and Benchmarking Verification Algorithms to Improve Text-to-SQL Generation 引用了 Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper2

  1. SafeNLIDB: A Privacy-Preserving Safety Alignment Framework for LLM-based Natural Language Database InterfacesRuiheng Liu, Xiaobing Chen, Jinyu Zhang, Qiongwen Zhang 等AAAI 2026 · 1 次引用
  2. Developing and Benchmarking Verification Algorithms to Improve Text-to-SQL GenerationTarfah Alrashed, Madhup Sukoon, David R. Karger, Natasha F. NoyVLDB 2026

它引用的 Paper8

  1. Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida 等NeurIPS 2022 · 24,707 次引用
  2. DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-CorrectionMohammadreza Pourreza, Davood RafieiNeurIPS 2023 · 909 次引用
  3. Text-to-SQL Empowered by Large Language Models: A Benchmark EvaluationDawei Gao, Haibin Wang, Yaliang Li, Xiuyu Sun 等VLDB 2024 · 609 次引用
  4. Before Generation, Align it! A Novel and Effective Strategy for Mitigating Hallucinations in Text-to-SQL GenerationGe Qu, Jinyang Li, Bowen Li, Bowen Qin 等ACL Findings 2024 · 32 次引用
  5. TrojanSQL: SQL Injection against Natural Language Interface to DatabaseJinchuan Zhang, Yan Zhou, Binyuan Hui, Yaxin Liu 等EMNLP 2023 · 5 次引用

相关 Paper

  1. Prompt-to-SQL Injections in LLM-Integrated Web Applications: Risks and DefensesRodrigo Pedro, Miguel E. Coimbra, Daniel Castro, Paulo Carreira 等ICSE 2025 · 14 次引用
  2. SPENCE: A Syntactic Probe for Detecting Contamination in NL2SQL BenchmarksMohammadtaher Safarzadeh, Hitesh Laxmichand Patel, Afshin Oroojlooy, Graham Horwood 等ACL 2026
  3. Keep Security! Benchmarking Security Policy Preservation in Large Language Model Contexts Against Indirect Attacks in Question AnsweringHwan Chang, Yumin Kim, Yonghyun Jun, Hwanhee LeeEMNLP 2025
  4. A Benchmark for Semantic Sensitive Information in LLMs OutputsQingjie Zhang, Han Qiu, Di Wang, Yiming Li 等ICLR 2025
  5. Are Your LLM-based Text-to-SQL Models Secure? Exploring SQL Injection via Backdoor AttacksMeiyu Lin, Haichuan Zhang, Jiale Lao, Renyuan Li 等SIGMOD 2026 · 4 次引用
黄昏的海面,两侧是细线勾勒的悬崖