arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.13026cs.LGcs.CR
收藏

PISmith: 基于强化学习的提示注入防御红队测试

PISmith: Reinforcement Learning-based Red Teaming for Prompt Injection Defenses

The Pennsylvania State University(宾夕法尼亚州立大学)

Chenlong Yin, Runpeng Geng, Yanting Wang, Jinyuan Jia

AI总结:

本文提出PISmith框架,通过强化学习评估现有提示注入防御的鲁棒性,发现标准GRPO在攻击强防御时表现不佳,引入自适应熵正则化和动态优势加权以提升探索能力,实验表明最新防御仍易受适应性攻击影响。

摘要:

提示注入对现实中的大语言模型应用构成严重安全风险,尤其是自主代理。尽管已提出许多防御措施,但其对适应性攻击的鲁棒性仍缺乏充分评估,可能造成虚假的安全感。本文提出PISmith,一种基于强化学习(RL)的红队测试框架,通过训练攻击LLM在实际黑盒设置中优化注入提示,以系统评估现有提示注入防御。我们发现直接应用标准GRPO攻击强防御会导致性能不佳,因为极端的奖励稀疏性使得大多数生成的注入提示被防御阻止,导致策略熵崩溃,无法发现有效攻击策略,而罕见的成功无法有效学习。为此,我们引入自适应熵正则化和动态优势加权以维持探索并放大稀少成功的学习。在13个基准上的广泛评估表明,最先进的提示注入防御仍易受适应性攻击影响。我们还比较了PISmith与7个基线方法,显示PISmith在静态、搜索基和RL基攻击类别中始终取得最高攻击成功率。此外,PISmith在InjecAgent和AgentDojo代理设置中对开源和闭源LLM(如GPT-4o-mini和GPT-5-nano)表现强劲。我们的代码可在https://github.com/albert-y1n/PISmith获取。

英文摘要:

Prompt injection poses serious security risks to real-world LLM applications, particularly autonomous agents. Although many defenses have been proposed, their robustness against adaptive attacks remains insufficiently evaluated, potentially creating a false sense of security. In this work, we propose PISmith, a reinforcement learning (RL)-based red-teaming framework that systematically assesses existing prompt-injection defenses by training an attack LLM to optimize injected prompts in a practical black-box setting, where the attacker can only query the defended LLM and observe its outputs. We find that directly applying standard GRPO to attack strong defenses leads to sub-optimal performance due to extreme reward sparsity -- most generated injected prompts are blocked by the defense, causing the policy's entropy to collapse before discovering effective attack strategies, while the rare successes cannot be learned effectively. In response, we introduce adaptive entropy regularization and dynamic advantage weighting to sustain exploration and amplify learning from scarce successes. Extensive evaluation on 13 benchmarks demonstrates that state-of-the-art prompt injection defenses remain vulnerable to adaptive attacks. We also compare PISmith with 7 baselines across static, search-based, and RL-based attack categories, showing that PISmith consistently achieves the highest attack success rates. Furthermore, PISmith achieves strong performance in agentic settings on InjecAgent and AgentDojo against both open-source and closed-source LLMs (e.g., GPT-4o-mini and GPT-5-nano). Our code is available at https://github.com/albert-y1n/PISmith.

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

↑