Lune

EMNLP2023Top-tier venue

TrojanSQL: SQL Injection against Natural Language Interface to Database

Jinchuan Zhang, Yan Zhou, Binyuan Hui, Yaxin Liu, Ziming Li, Songlin Hu

Abstract

The technology of text-to-SQL has significantly enhanced the efficiency of accessing and manipulating databases. However, limited research has been conducted to study its vulnerabilities emerging from malicious user interaction. By proposing TrojanSQL, a backdoor-based SQL injection framework for text-to-SQL systems, we show how state-of-the-art text-to-SQL parsers can be easily misled to produce harmful SQL statements that can invalidate user queries or compromise sensitive information about the database. The study explores two specific injection attacks, namely boolean-based injection and union-based injection, which use different types of triggers to achieve distinct goals in compromising the parser. Experimental results demonstrate that both medium-sized models based on fine-tuning and LLM-based parsers using prompting techniques are vulnerable to this type of attack, with attack success rates as high as 99% and 89%, respectively. We hope that this study will raise more concerns about the potential security risks of building natural language interfaces to databases.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

4 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • VisPoison: An Effective Backdoor Attack Framework for Tabular Data Visualization Models cites Weight Poisoning Attacks on Pretrained Models
  • VisPoison: An Effective Backdoor Attack Framework for Tabular Data Visualization Models cites Are Your LLM-based Text-to-SQL Models Secure? Exploring SQL Injection via Backdoor Attacks
  • Teaching Large Language Models to Self-Debug cites Language Models are Few-Shot Learners
  • Poisoning Language Models During Instruction Tuning cites Language Models are Few-Shot Learners
  • Poisoning Language Models During Instruction Tuning cites Weight Poisoning Attacks on Pretrained Models
  • Are Your LLM-based Text-to-SQL Models Secure? Exploring SQL Injection via Backdoor Attacks cites Weight Poisoning Attacks on Pretrained Models
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers4

  1. SkillScope: Toward Fine-Grained Least-Privilege Enforcement for Agent SkillsJiangrong Wu, Yuhong Nan, Yixi Lin, Huaijin Wang et al.CCS 2026 · 5 citations
  2. Are Your LLM-based Text-to-SQL Models Secure? Exploring SQL Injection via Backdoor AttacksMeiyu Lin, Haichuan Zhang, Jiale Lao, Renyuan Li et al.SIGMOD 2026 · 4 citations
  3. Holistic Automated Red Teaming for Large Language Models through Top-Down Test Case Generation and Multi-turn InteractionJinchuan Zhang, Yan Zhou, Yaxin Liu, Ziming Li et al.EMNLP 2024 · 2 citations
  4. VisPoison: An Effective Backdoor Attack Framework for Tabular Data Visualization ModelsShuaimin Li, Chen Jason Zhang, Xuanang Chen, Anni Peng et al.ICDE 2026

Builds on16

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Toolformer: Language Models Can Teach Themselves to Use ToolsTimo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu et al.NeurIPS 2023 · 5,989 citations
  3. Teaching Large Language Models to Self-DebugXinyun Chen, Maxwell Lin, Nathanael Schärli, Denny ZhouICLR 2024 · 1,085 citations
  4. Poisoning Language Models During Instruction TuningAlexander Wan, Eric Wallace, Sheng Shen, Dan KleinICML 2023 · 319 citations
  5. Weight Poisoning Attacks on Pretrained ModelsKeita Kurita, Paul Michel, Graham NeubigACL 2020 · 312 citations

Related papers

  1. AIA: Autoregression-Based Injection Attacks Against Text2SQL ModelsDeyin Li, Xiang Ling, Changjiang Li, Xiang Chen et al.AAAI 2025
  2. Structure-Guided Large Language Models for Text-to-SQL GenerationQinggang Zhang, Hao Chen, Junnan Dong, Shengyuan Chen et al.ICML 2025
  3. Prompt-to-SQL Injections in LLM-Integrated Web Applications: Risks and DefensesRodrigo Pedro, Miguel E. Coimbra, Daniel Castro, Paulo Carreira et al.ICSE 2025 · 14 citations
  4. "What Do You Mean by That?" A Parser-Independent Interactive Approach for Enhancing Text-to-SQLYuntao Li, Bei Chen, Qian Liu, Yan Gao et al.EMNLP 2020 · 17 citations
  5. SQLens: An End-to-End Framework for Error Detection and Correction in Text-to-SQLYue Gong, Chuan Lei, Xiao Qin, Kapil Vaidya et al.NeurIPS 2025 · 21 citations
Dusk over the sea between two cliffs drawn in fine vertical lines