Preventing Prompt Injection with Type-Directed Privilege Separation

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Jacob, Dennis, Alghamdi, Emad, Hu, Zhanhao, Alomair, Basel, Wagner, David
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909027506585600
author Jacob, Dennis
Alghamdi, Emad
Hu, Zhanhao
Alomair, Basel
Wagner, David
author_facet Jacob, Dennis
Alghamdi, Emad
Hu, Zhanhao
Alomair, Basel
Wagner, David
contents Modern language models have enabled the development of agentic systems that achieve strong performance on reasoning-intensive tasks. Unfortunately, this has come with a security cost; these systems are vulnerable to prompt injection, a specialized attack where an adversary subverts the intended functionality of an agent by supplying an injected task of their own. Previous approaches address this challenge with detectors and fine-tuning defenses but are vulnerable to adaptive attacks. Other methods propose system-level defenses that guarantee security, but these are often based on techniques that prevent inter-component communication and thus are constrained in problem coverage. To this end, we introduce type-directed privilege separation, a new technique that expands the set of tasks that can be protected with system-level defenses. Our method works by converting untrusted data to a curated set of data types; unlike raw strings, each data type is limited in scope and content, eliminating the possibility for prompt injection. We evaluate our method across several case studies and find that designs using our principles can systematically prevent prompt injection attacks while featuring strong, non-trivial utility. Our approach is intuitive to understand and compatible with any language model.
format Preprint
id arxiv_https___arxiv_org_abs_2509_25926
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Preventing Prompt Injection with Type-Directed Privilege Separation
Jacob, Dennis
Alghamdi, Emad
Hu, Zhanhao
Alomair, Basel
Wagner, David
Cryptography and Security
Machine Learning
Modern language models have enabled the development of agentic systems that achieve strong performance on reasoning-intensive tasks. Unfortunately, this has come with a security cost; these systems are vulnerable to prompt injection, a specialized attack where an adversary subverts the intended functionality of an agent by supplying an injected task of their own. Previous approaches address this challenge with detectors and fine-tuning defenses but are vulnerable to adaptive attacks. Other methods propose system-level defenses that guarantee security, but these are often based on techniques that prevent inter-component communication and thus are constrained in problem coverage. To this end, we introduce type-directed privilege separation, a new technique that expands the set of tasks that can be protected with system-level defenses. Our method works by converting untrusted data to a curated set of data types; unlike raw strings, each data type is limited in scope and content, eliminating the possibility for prompt injection. We evaluate our method across several case studies and find that designs using our principles can systematically prevent prompt injection attacks while featuring strong, non-trivial utility. Our approach is intuitive to understand and compatible with any language model.
title Preventing Prompt Injection with Type-Directed Privilege Separation
topic Cryptography and Security
Machine Learning
url https://arxiv.org/abs/2509.25926