mlsanityData to 7 Oct 2026

RL Is a Hammer and LLMs Are Nails: A Simple Reinforcement Learning Recipe for Strong Prompt Injection

arXiv 2510.04885 ↗First posted 6 Oct 2025cs.CR cs.LGcited by 32

On the map: LLM agents and tool use → Agent threats, guardrails and governance

also in 1 more
Abstract (arXiv)

Prompt injection poses a serious threat to the reliability and safety of LLM agents. Recent defenses against prompt injection, such as Instruction Hierarchy and SecAlign, have shown notable robustness against static attacks. However, to more thoroughly evaluate the robustness of these defenses, it is arguably necessary to employ strong attacks such as automated red-teaming. To this end, we introduce RL-Hammer, a simple recipe for training attacker models that automatically learn to perform strong prompt injections and jailbreaks via reinforcement learning. RL-Hammer requires no warm-up data and can be trained entirely from scratch. To achieve high ASRs against industrial-level models with defenses, we propose a set of practical techniques that enable highly effective, universal attacks. Using this pipeline, RL-Hammer reaches a 98% ASR against GPT-4o and a 72% ASR against GPT-5 with the Instruction Hierarchy defense. We further discuss the challenge of achieving high diversity in attacks, highlighting how attacker models tend to reward-hack diversity objectives. Finally, we show that RL-Hammer can evade multiple prompt injection detectors. We hope our work advances automatic red-teaming and motivates the development of stronger, more principled defenses. Code is available at https://github.com/facebookresearch/rl-injector.

Key facts. Cited by 32 papers in the map (data through 7 Oct 2026). Placed in Agent threats, guardrails and governance, one of 16 directions in LLM agents and tool use. Builds on 33 of its 48 references that are in the map. First posted on arXiv 6 Oct 2025.

Builds on

33 of 48 references.

Closest ancestors · 5

Same direction, newest first

  1. 2025WASP: Benchmarking Web Agent Security Against Prompt Injection Attacks22 Apr
  2. 2025AgentDAM: Privacy Leakage Evaluation for Autonomous Web Agents12 Mar
  3. 2025Commercial LLM Agents Are Already Vulnerable to Simple Yet Dangerous Attacks12 Feb
  4. 2024AdvAgent: Controllable Blackbox Red-teaming on Web Agents22 Oct
  5. 2024InjecAgent: Benchmarking Indirect Prompt Injections in Tool-Integrated Large Language Model Agents5 Mar

Other references · 28

  1. 2017Proximal Policy Optimization Algorithmscited by 14,441
  2. 2024The Llama 3 Herd of Modelscited by 14,192
  3. 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 8,851
  4. 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
  5. 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 7,916
  6. 2019BERTScore: Evaluating Text Generation with BERTcited by 5,462
  7. 2024GPT-4o System Cardcited by 4,467
  8. 2023Toolformer: Language Models Can Teach Themselves to Use Toolscited by 4,072
  9. 2025Gemini 2.5: Pushing the Frontier with Advanced Reasoning, Multimodality, Long Context, and Next Generation Agentic Capabilitiescited by 3,655
  10. 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 2,914
  11. 2023Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injectioncited by 1,339
  12. 2024HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusalcited by 1,330
16 more
  1. 2022Red Teaming Language Models with Language Modelscited by 983
  2. 2023Baseline Defenses for Adversarial Attacks Against Aligned Language Modelscited by 608
  3. 2024The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructionscited by 441
  4. 2023Hard Prompts Made Easy: Gradient-Based Discrete Optimization for Prompt Tuning and Discoverycited by 329
  5. 2023Formalizing and Benchmarking Prompt Injection Attacks and Defensescited by 328
  6. 2024StruQ: Defending Against Prompt Injection with Structured Queriescited by 325
  7. 2023Benchmarking and Defending Against Indirect Prompt Injection Attacks on Large Language Modelscited by 237
  8. 2021Gradient-based Adversarial Attacks against Text Transformerscited by 233
  9. 2024SecAlign: Defending Against Prompt Injection with Preference Optimizationcited by 179
  10. 2024AdvPrompter: Fast Adaptive Adversarial Prompting for LLMscited by 146
  11. 2024Automatic and Universal Prompt Injection Attacks against Large Language Modelscited by 112
  12. 2023AutoDAN: Interpretable Gradient-Based Adversarial Attacks on Large Language Modelscited by 102
  13. 2024Neural Exec: Learning (and Learning from) Execution Triggers for Prompt Injection Attackscited by 78
  14. 2024Instructional Segment Embedding: Improving LLM Safety with Instruction Hierarchycited by 62
  15. 2025Jailbreak-R1: Exploring the Jailbreak Capabilities of LLMs via Reinforcement Learningcited by 21
  16. 2025May I have your Attention? Breaking Fine-Tuning based Prompt Injection Defenses using Architecture-Aware Attackscited by 14

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 5; 2026: 27.

32 papers.

Sort:

By area:

  1. 2025The Attacker Moves Second: Stronger Adaptive Attacks Bypass Defenses Against Llm Jailbreaks and Prompt Injectionscited by 108
  2. 2026AgentLAB: Benchmarking LLM Agents against Long-Horizon Attackscited by 31
  3. 2026The Landscape of Prompt Injection Threats in LLM Agents: From Taxonomy to Analysiscited by 25
  4. 2026Learning to Inject: Automated Prompt Injection via Reinforcement Learningcited by 14
  5. 2026IH-Challenge: A Training Dataset to Improve Instruction Hierarchy on Frontier LLMscited by 14
  6. 2026PISmith: Reinforcement Learning-based Red Teaming for Prompt Injection Defensescited by 13
  7. 2026Prompt Injection as Role Confusioncited by 11
  8. 2026PIArena: A Platform for Prompt Injection Evaluationcited by 10
  9. 2025Mitigating Indirect Prompt Injection via Instruction-Following Intent Analysiscited by 9
  10. 2026Architecting Secure AI Agents: Perspectives on System-Level Defenses Against Indirect Prompt Injection Attackscited by 9
  11. 2025Safety Alignment of LMs via Non-cooperative Gamescited by 6
  12. 2026Safeguarding LLM Agents against Long-Horizon Threats via Shadow Memorycited by 6
20 more
  1. 2025Reasoning Up the Instruction Ladder for Controllable Language Modelscited by 5
  2. 2026AgenticRed: Evolving Agentic Systems for Red-Teamingcited by 4
  3. 2026Learning to Attack and Defend: Adaptive Red Teaming of Language Models via GRPOcited by 4
  4. 2026AutoDojo: Adaptive Black-Box Attacks Reveal the Limits of IPI Defenses and Task-Specification Effects in LLM Agentscited by 4
  5. 2026Web Agents Should Adopt the Plan-Then-Execute Paradigmcited by 3
  6. 2026Conjunctive Prompt Attacks in Multi-Agent LLM Systemscited by 2
  7. 2026SecOPD: Mitigating Adaptive Prompt Injections by On-Policy Distillationcited by 2
  8. 2026David vs. Goliath: Verifiable Agent-to-Agent Jailbreaking via Reinforcement Learningcited by 1
  9. 2026Domain-Conditioned Safety in Frontier Computer-Using Agents: A 793-Episode Browser Benchmark, a Coding-Domain Cross-Reference, and a Reproducibility Audit of Recent Red-Teamingcited by 1
  10. 2026How Reliable Is Your Jailbreak Judge? Calibration and Adversarial Robustness of Automated ASR Scoringcited by 1
  11. 2026Prismata: Confining Cross-Site Prompt Injection in Web Agentscited by 1
  12. 2026Agent Against Agent: An Agentic System for Automatic Prompt Injection Red Teamingcited by 1
  13. 2026LongPIBench: A Long-Context Benchmark for Prompt Injectioncited by 1
  14. 2025Distillability of LLM Security Logic: Predicting Attack Success Rate of Outline Filling Attack via Ranking Regressioncited by 0
  15. 2026FlashRT: Towards Computationally and Memory Efficient Red-Teaming for Prompt Injection and Knowledge Corruptioncited by 0
  16. 2026Model-Agnostic Lifelong LLM Safety via Externalized Attack-Defense Co-Evolutioncited by 0
  17. 2026Governing Execution Risk in Agentic AI Systems: A Trajectory-Guided Framework for Red Teamingcited by 0
  18. 2026Climbing the Hill: Prompt Injection Red-Teaming Against Frontier Models with Curriculum Reinforcement Learningcited by 0
  19. 2026Render Before Reading: Visual Rendering as a Prompt Injection Defensecited by 0
  20. 2026Divide and Inject: Can Agents Reconstruct an Indirect Prompt Injection from Fragments?cited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2026Assessing Automated Prompt Injection Attacks in Agentic Environments
  2. 2026Defending against Adaptive Prompt Injection Attacks via Reasoning-enabled Task Alignment
  3. 2026Defense Against Indirect Prompt Injection via Tool Result Parsing
  4. 2024RL-JACK: Reinforcement Learning-powered Black-box Jailbreaking Attack against LLMs
  5. 2025Beyond the Benchmark: Innovative Defenses Against Prompt Injection Attacks
  6. 2026GPT-Red: Automated Red Teaming via Self-Play at Scale
  7. 2026CoDeL: Co-Evolutionary Defense against Indirect Prompt Injection in LLM-based Agents
  8. 2026RAISED: Self-Distillation for Robustness to Prompt Injection in LLM Agents