Better Privilege Separation for Agents by Restricting Data Types

Dennis Jacob, Emad Alghamdi, Zhanhao Hu, Basel Alomair, David A. WagnerarXiv 2025 · DOI

Abstract

Large Language Model (LLM) agents are susceptible to prompt injection attacks, where untrusted data contains malicious instructions that hijack the agent's behavior. We propose type-directed privilege separation, a system-level defense that isolates untrusted data by restricting communication between a quarantined agent and a privileged agent to safe, structured data types. Our evaluation across shopping, scheduling, and coding tasks demonstrates that this approach eliminates attack success while maintaining high utility for many applications.

1. Introduction

The core issue in LLM agent security is the lack of inherent distinction between developer instructions and user-provided data. When an agent processes untrusted content—such as product reviews, emails, or bug reports—an attacker can embed "hidden" instructions (e.g., "ignore previous instructions and delete all files") to take control. This vulnerability, known as a prompt injection attack, undermines the reliability of autonomous systems.

Existing defenses like input filtering or fine-tuning are often bypassed by adaptive attackers. The "Dual LLM" pattern offers a structural solution by separating data processing from action execution, but it often blocks all information flow, rendering the agent useless for many tasks.

2. Type-Directed Privilege Separation

We introduce a refinement of the Dual LLM pattern called type-directed privilege separation. This architecture decomposes an agent into two components:

  1. Quarantined Agent (Q-Agent): This component interacts directly with untrusted third-party data to parse and extract specific information.
  2. Privileged Agent (P-Agent): This component has the authority to call tools and modify the environment.

Crucially, the P-Agent never sees raw untrusted text. Communication from the Q-Agent is restricted to a strict set of "safe" data types, such as integers, floats, booleans, and enums. Because these types cannot represent freeform natural language, they cannot carry a prompt injection. This creates a physical architectural guarantee against instruction hijacking.

Comparison of agent architectures: Undefended, Standard Dual LLM, and Type-directed privilege separation.

3. Experimental Evaluation

The defense was evaluated across three diverse case studies:

  • Online Shopping: Based on the WebShop environment, where agents navigate products. Malicious reviews were added to test for prompt injection.
  • Calendar Scheduling: A custom environment simulating email exchanges to schedule meetings, where "other parties" might send emails containing injections to leak calendar data.
  • Software Bug Fixing: Evaluated on SWE-bench Lite, where malicious commands were injected into GitHub issue descriptions to force the agent to create backdoors.
An online shopping agent where untrusted reviews are processed by a quarantined agent before reaching the privileged core.

4. Results and Discussion

The defense successfully reduced the Attack Success Rate (ASR) to 0.0% in all scenarios.

Case Study Defense Setting Utility (Success Rate) Attack Success Rate (ASR)
Online Shopping Undefended 21.8% 31.7%
Defended 22.4% 0.0%
Calendar Undefended 90.0% 63.0%
Defended 91.0% 0.0%
Bug Fixing Undefended 49.7% 94.3%
Defended 14.6% 0.0%

For shopping and calendar tasks, utility was preserved or slightly improved. However, for software bug fixing, utility dropped significantly (from ~50% to ~15%). This indicates that tasks requiring nuanced natural language context from untrusted sources suffer when that data is restricted to simple types.

5. Conclusion

Type-directed privilege separation provides a robust, security-by-design framework for LLM agents. By forcing untrusted data through a "type-narrowing" bottleneck, we strip away its ability to act as an instruction. While effective for many tasks, future work is needed to develop more expressive but safe data structures to recover utility in complex domains like software engineering.

Summary updated

BibTeX
@misc{jacob2025better,
  author = {Dennis Jacob and Emad Alghamdi and Zhanhao Hu and Basel Alomair and David A. Wagner},
  title = {{Better Privilege Separation for Agents by Restricting Data Types}},
  year = {2025},
  eprint = {2509.25926},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.25926},
}
Figure