arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2503.05445cs.CRcs.DB
收藏

您的基于LLM的Text-to-SQL模型安全吗?探索通过后门攻击的SQL注入

Are Your LLM-based Text-to-SQL Models Secure? Exploring SQL Injection via Backdoor Attacks

Meiyu Lin, Haichuan Zhang, Jiale Lao, Renyuan Li, Yuanchun Zhou, Carl Yang, Yang Cao, Mingjie Tang

AI总结:

本研究提出ToxicSQL后门攻击框架,利用语义和字符级触发器及SQL注入载荷,仅注入0.44%数据即可达79.41%攻击成功率,并提出了检测与缓解策略,凸显了Text-to-SQL安全防御的紧迫性。

摘要:

大型语言模型(LLMs)在将自然语言问题转换为SQL查询(Text-to-SQL)方面展示了最先进的结果,这是数据库社区长期面临的挑战。然而,安全问题在很大程度上仍未得到探索,特别是后门攻击的威胁,这种攻击可以通过使用中毒数据集进行微调将恶意行为引入模型。在这项工作中,我们系统地研究了基于LLM的Text-to-SQL模型的漏洞,并提出了ToxicSQL,一种新颖的后门攻击框架。我们的方法利用隐蔽的语义和字符级触发器,使后门难以检测和移除,确保恶意行为保持隐蔽,同时保持模型在良性输入上的高准确性。此外,我们提出利用SQL注入载荷作为后门目标,从而能够生成恶意但可执行的SQL查询,这在基于语言模型的SQL开发中构成严重的安全和隐私风险。我们证明,仅注入0.44%的中毒数据即可实现79.41%的攻击成功率,对数据库安全构成重大风险。此外,我们提出了检测和缓解策略以增强模型可靠性。我们的发现强调了安全意识的Text-to-SQL开发的紧迫需求,强调了针对后门威胁的强健防御的重要性。

英文摘要:

Large language models (LLMs) have shown state-of-the-art results in translating natural language questions into SQL queries (Text-to-SQL), a long-standing challenge within the database community. However, security concerns remain largely unexplored, particularly the threat of backdoor attacks, which can introduce malicious behaviors into models through fine-tuning with poisoned datasets. In this work, we systematically investigate the vulnerabilities of LLM-based Text-to-SQL models and present ToxicSQL, a novel backdoor attack framework. Our approach leverages stealthy {semantic and character-level triggers} to make backdoors difficult to detect and remove, ensuring that malicious behaviors remain covert while maintaining high model accuracy on benign inputs. Furthermore, we propose leveraging SQL injection payloads as backdoor targets, enabling the generation of malicious yet executable SQL queries, which pose severe security and privacy risks in language model-based SQL development. We demonstrate that injecting only 0.44% of poisoned data can result in an attack success rate of 79.41%, posing a significant risk to database security. Additionally, we propose detection and mitigation strategies to enhance model reliability. Our findings highlight the urgent need for security-aware Text-to-SQL development, emphasizing the importance of robust defenses against backdoor threats.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑