用模糊测试法自动发现大模型提示注入漏洞,提升安全防护能力。
PROMPTFUZZ: Harnessing Fuzzing Techniques for Robust Testing of Prompt Injection in LLMs
- 借鉴软件模糊测试,生成多样攻击提示评估模型抗性
- 在真实竞赛中2小时内跻身前0.14%,发现强防御模型漏洞
- 提供可微调数据集,适合安全研究者与模型开发者使用
大型语言模型(LLMs)因生成类人文本的能力被广泛应用,但提示注入攻击(通过恶意提示覆盖原指令操控输出)严重威胁其安全与可靠性。本文提出PROMPTFUZZ,一种基于模糊测试的新型评测框架,系统性检测LLM对提示注入的鲁棒性。该框架分两阶段:准备阶段筛选优质初始种子并收集少样本示例;聚焦阶段利用这些示例生成多样化高质量攻击提示。实验表明,即使面对具备强防御机制的模型,PROMPTFUZZ仍能发现更多漏洞。在真实世界竞赛中,使用其生成的攻击提示,团队在4000+参赛者中排名第7(前0.14%),仅用2小时。此外,我们构建了用于微调的专用数据集,使模型鲁棒性提升,但PROMPTFUZZ仍持续识别出新漏洞,凸显了持续测试的重要性。本工作强调高效测试工具的必要性,为评估和提升LLM抗提示注入能力提供了实用框架。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have gained widespread use in various applications due to their powerful capability to generate human-like text. However, prompt injection attacks, which involve overwriting a model's original instructions with malicious prompts to manipulate the generated text, have raised significant concerns about the security and reliability of LLMs. Ensuring that LLMs are robust against such attacks is crucial for their deployment in real-world applications, particularly in critical tasks. In this paper, we propose PROMPTFUZZ, a novel testing framework that leverages fuzzing techniques to systematically assess the robustness of LLMs against prompt injection attacks. Inspired by software fuzzing, PROMPTFUZZ selects promising seed prompts and generates a diverse set of prompt injections to evaluate the target LLM's resilience. PROMPTFUZZ operates in two stages: the prepare phase, which involves selecting promising initial seeds and collecting few-shot examples, and the focus phase, which uses the collected examples to generate diverse, high-quality prompt injections. Using PROMPTFUZZ, we can uncover more vulnerabilities in LLMs, even those with strong defense prompts. By deploying the generated attack prompts from PROMPTFUZZ in a real-world competition, we achieved the 7th ranking out of over 4000 participants (top 0.14%) within 2 hours. Additionally, we construct a dataset to fine-tune LLMs for enhanced robustness against prompt injection attacks. While the fine-tuned model shows improved robustness, PROMPTFUZZ continues to identify vulnerabilities, highlighting the importance of robust testing for LLMs. Our work emphasizes the critical need for effective testing tools and provides a practical framework for evaluating and improving the robustness of LLMs against prompt injection attacks.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。