English

Defeating Prompt Injections by Design

Cryptography and Security 2025-06-25 v2 Artificial Intelligence

Abstract

Large Language Models (LLMs) are increasingly deployed in agentic systems that interact with an untrusted environment. However, LLM agents are vulnerable to prompt injection attacks when handling untrusted data. In this paper we propose CaMeL, a robust defense that creates a protective system layer around the LLM, securing it even when underlying models are susceptible to attacks. To operate, CaMeL explicitly extracts the control and data flows from the (trusted) query; therefore, the untrusted data retrieved by the LLM can never impact the program flow. To further improve security, CaMeL uses a notion of a capability to prevent the exfiltration of private data over unauthorized data flows by enforcing security policies when tools are called. We demonstrate effectiveness of CaMeL by solving 77%77\% of tasks with provable security (compared to 84%84\% with an undefended system) in AgentDojo. We release CaMeL at https://github.com/google-research/camel-prompt-injection.

Keywords

Cite

@article{arxiv.2503.18813,
  title  = {Defeating Prompt Injections by Design},
  author = {Edoardo Debenedetti and Ilia Shumailov and Tianqi Fan and Jamie Hayes and Nicholas Carlini and Daniel Fabian and Christoph Kern and Chongyang Shi and Andreas Terzis and Florian Tramèr},
  journal= {arXiv preprint arXiv:2503.18813},
  year   = {2025}
}

Comments

Updated version with newer models and link to the code

R2 v1 2026-06-28T22:32:31.882Z