{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/defeating-prompt-injections-by-design","title":"Defeating Prompt Injections by Design","arxiv_id":"2503.18813","date":"2025-03-24","proceeding":null,"authors":["Edoardo Debenedetti","Ilia Shumailov","Tianqi Fan","Jamie Hayes","Nicholas Carlini","Daniel Fabian","Christoph Kern","Chongyang Shi","Andreas Terzis","Florian Tramèr"],"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\\%$ of tasks with provable security (compared to $84\\%$ with an undefended system) in AgentDojo. We release CaMeL at https://github.com/google-research/camel-prompt-injection.","url_abs":"https://arxiv.org/abs/2503.18813v2","url_pdf":"https://arxiv.org/pdf/2503.18813v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"defeating-prompt-injections-by-design","repo_url":"https://github.com/google-research/camel-prompt-injection","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2503.18813","atlas_url":"https://app.syntology.ai/?focus=2503.18813","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2503.18813"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/google-research/camel-prompt-injection","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":4},"by_repo_kind":{"official":{"samples":4,"ran":4,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"952913b23741ba53","entry":"conditional_lru_cache","repo":"google-research/camel-prompt-injection","repo_kind":"official","path":"src/camel/conditional_cache.py","file_url":"https://github.com/google-research/camel-prompt-injection/blob/HEAD/src/camel/conditional_cache.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"952913b23741ba53"}},{"code_sha256_prefix":"acef218b3bc2a330","entry":"time_constructor","repo":"google-research/camel-prompt-injection","repo_kind":"official","path":"src/camel/custom_yaml.py","file_url":"https://github.com/google-research/camel-prompt-injection/blob/HEAD/src/camel/custom_yaml.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"acef218b3bc2a330"}},{"code_sha256_prefix":"337a861598ff561a","entry":"time_representer","repo":"google-research/camel-prompt-injection","repo_kind":"official","path":"src/camel/custom_yaml.py","file_url":"https://github.com/google-research/camel-prompt-injection/blob/HEAD/src/camel/custom_yaml.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"337a861598ff561a"}},{"code_sha256_prefix":"c242735fb46e1ead","entry":"wrap_message","repo":"google-research/camel-prompt-injection","repo_kind":"official","path":"src/camel/count_tokens.py","file_url":"https://github.com/google-research/camel-prompt-injection/blob/HEAD/src/camel/count_tokens.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c242735fb46e1ead"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}