arXiv:2602.05746cs.LGcs.AI2026-02被引 6

用强化学习自动生成能触发特定工具调用的攻击后缀

Learning to Inject: Automated Prompt Injection via Reinforcement Learning

  • 设计基于比较的奖励机制,将二元成功信号转为可优化的密集奖励
  • 在AgentDojo上优于模板攻击、GCG等方法,对防注入模型也有效
  • 支持离线训练可迁移后缀,适合安全测试与防御评估场景

提示注入是大语言模型代理中的关键漏洞,但现有最强方法仍依赖人工红队和手工构造提示。传统自动化越狱优化器无法弥补这一差距:越狱侧重通用服从性,而提示注入需精确输出特定工具调用及参数。成功信号为二值,随机采样后缀几乎无法触发,标准优化器无梯度可循。本文提出AutoInject,一种黑盒强化学习框架,用于学习对抗性后缀以实现提示注入。该框架采用基于比较的奖励机制,将每个候选后缀与已知最佳后缀对比,将二值信号转化为适合强化学习优化的密集奖励。支持在线查询式攻击和离线训练的可迁移后缀(部署时无需访问目标系统),并在任务完成反馈可用时集成效用目标。在AgentDojo上,AutoInject显著优于模板攻击、GCG、TAP及自适应攻击,在生产模型中表现突出,经McNemar检验(p<0.05)具有统计显著性。所学后缀还能攻破专门针对提示注入进行微调的Meta-SecAlign-70B模型,而模板攻击完全失效。结果确立了提示注入的自动化基准,并揭示了基于偏好防御与基于自适应优化攻击之间的差距。

原文摘要 · Abstract (English)

Prompt injection is a critical vulnerability in LLM agents, yet the strongest methods still rely on human red-teamers and hand-crafted prompts. Adapting automated jailbreak optimizers does not close this gap: jailbreaks shape models toward generic compliance, while prompt injection requires emitting specific tool calls with correct parameters. The success signal is binary, and randomly sampled suffixes almost never trigger it, so standard optimizers have no gradient to follow. We present AutoInject, a black-box reinforcement learning (RL) framework that learns adversarial suffixes for prompt injection. A learned comparison-based reward scores each candidate against the best suffix seen so far, turning the binary signal into a dense reward suitable for RL optimization. The framework supports both online query-based attacks and offline-trained transferable suffixes that need no utility access at deployment, and incorporates a utility objective when task-completion feedback is available. On AgentDojo, AutoInject outperforms template attacks, GCG, TAP, and adaptive attack across production models, with statistically significant improvements under McNemar's test with p<0.05. Suffixes learned by AutoInject also break Meta-SecAlign-70B, a model fine-tuned specifically to resist prompt injection, where template attacks fail outright. The results establish an automated baseline for prompt injection and expose a gap between preference-based defenses and adaptive optimization-based attackers.

提示注入强化学习安全测试对抗攻击

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。