用哈希标签认证响应,防间接提示注入攻击
FATH: Authentication-based Test-time Defense against Indirect Prompt Injection Attacks
- 通过哈希标签标记响应,实现指令来源认证
- 在Llama3和GPT3.5上防御成功率超90%且抗适应性攻击
- 适合部署在需安全接入外部信息的LLM应用中
大型语言模型(LLMs)被广泛用于集成工具与文本信息的现实应用中,但引入外部信息带来严重安全风险。其中,提示注入攻击尤为危险,恶意指令可诱导模型生成攻击者期望的输出。尽管已有训练时和测试时防御方法,但前者成本过高,后者效果有限。本文提出一种新型测试时防御策略FATH(Formatting AuThentication with Hash-based tags),不阻止模型响应外部指令,而是构建认证系统:要求模型对所有指令按安全策略回应,并仅选择性输出用户指令的响应。该方法利用哈希标签标识每条响应,精准识别用户指令并提升对自适应攻击的鲁棒性。大量实验表明,FATH在多种攻击方法下对Llama3和GPT3.5均达领先性能,显著优于现有方法。
原文摘要 · Abstract (English)
Large language models (LLMs) have been widely deployed as the backbone with additional tools and text information for real-world applications. However, integrating external information into LLM-integrated applications raises significant security concerns. Among these, prompt injection attacks are particularly threatening, where malicious instructions injected in the external text information can exploit LLMs to generate answers as the attackers desire. While both training-time and test-time defense methods have been developed to mitigate such attacks, the unaffordable training costs associated with training-time methods and the limited effectiveness of existing test-time methods make them impractical. This paper introduces a novel test-time defense strategy, named Formatting AuThentication with Hash-based tags (FATH). Unlike existing approaches that prevent LLMs from answering additional instructions in external text, our method implements an authentication system, requiring LLMs to answer all received instructions with a security policy and selectively filter out responses to user instructions as the final output. To achieve this, we utilize hash-based authentication tags to label each response, facilitating accurate identification of responses according to the user's instructions and improving the robustness against adaptive attacks. Comprehensive experiments demonstrate that our defense method can effectively defend against indirect prompt injection attacks, achieving state-of-the-art performance under Llama3 and GPT3.5 models across various attack methods. Our code is released at: https://github.com/Jayfeather1024/FATH
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。