Tap a table row for details. Rotate for best experience.

What’s in Your Agent’s Context? Context Privilege Escalation Attacks against AI Agent Harness

Abstract

Real-world AI agent harnesses assemble model context from heterogeneous sources, yet their source selection, loading logic, and role assignment are often opaque. The paper systematically studies these designs and introduces two attack classes: message-role context privilege escalation (MCPE), where attacker-controlled content enters a higher-privileged message role, and cross-scope context privilege escalation (XCPE), where attacker influence persists beyond its originating context. Across 12 agent harnesses, the study identifies practical consequences including full agent compromise, remote code execution, denial of service, and manipulated tool or skill invocations.

Attack Vector Taxonomy

We identify 16 context privilege-escalation attack vectors across three categories: diverse context sources, context markup, and context assembly logic.

Markup Tag Catalog Explore the complete agent-specific prompt and runtime tag inventory
Attack Vector Category Specific Attack Vectors
A Diverse Context Sources
A-1Agent-specific memory files with roles
A-2Memory searching directories
A-3Runtime Memory Loading
A-4Agent-Specific Skill Searching Paths
A-5Runtime Skill Discovery
A-6Loading environment information to context
A-7Recursive Memory Importing
B Context Markup
B-1Markup Tag Insertion
B-2Markup Tag Interpretation
C Context Assembly Logic
C-1Priority in loading memory files
C-2Priority in loading skills
C-3Skill duplication resolution
C-4Self-modification of Agent Configuration
C-5Inline actions in context sources
C-6Refreshing Context
C-7Unsandboxed built-in Tools

Taxonomy of CPE Attack Vectors.

Diverse Context Sources
Agent harnesses load context from heterogeneous sources, including memory files, skills, environment metadata, and component outputs. Many of these sources, loading paths, and assigned roles are agent-specific or proprietary, making them opaque to ordinary users and easy to overlook as attack surfaces.
Context Markup
Harnesses use plaintext, agent-specific markup to separate context components and encode model-output actions. Forged tags can blur source boundaries or make repeated model text look like a tool call or other runtime action.
Context Assembly Logic
Harness-specific logic selects, orders, filters, overrides, refreshes, and sometimes executes source content. Insecure priority, duplicate resolution, self-modification, or inline-action behavior can make attacker-controlled content more privileged, persistent, or directly actionable.

Attack Demos

The first five demos correspond to the paper’s end-to-end case studies. The sixth is a separate Codex Skill Explosion demonstration. Use the case selector, arrow buttons, or a swipe gesture to switch between them.