English

Learning to Inject: Automated Prompt Injection via Reinforcement Learning

Machine Learning 2026-02-23 v1 Artificial Intelligence

Abstract

Prompt injection is one of the most critical vulnerabilities in LLM agents; yet, effective automated attacks remain largely unexplored from an optimization perspective. Existing methods heavily depend on human red-teamers and hand-crafted prompts, limiting their scalability and adaptability. We propose AutoInject, a reinforcement learning framework that generates universal, transferable adversarial suffixes while jointly optimizing for attack success and utility preservation on benign tasks. Our black-box method supports both query-based optimization and transfer attacks to unseen models and tasks. Using only a 1.5B parameter adversarial suffix generator, we successfully compromise frontier systems including GPT 5 Nano, Claude Sonnet 3.5, and Gemini 2.5 Flash on the AgentDojo benchmark, establishing a stronger baseline for automated prompt injection research.

Keywords

Cite

@article{arxiv.2602.05746,
  title  = {Learning to Inject: Automated Prompt Injection via Reinforcement Learning},
  author = {Xin Chen and Jie Zhang and Florian Tramèr},
  journal= {arXiv preprint arXiv:2602.05746},
  year   = {2026}
}
R2 v1 2026-07-01T09:38:03.982Z