arXiv(opens in a new tab)cs.CRAug 2026Cited by 2 papers on PaperVantage

Manuscript Offprint

arXiv:2608.27299

When Context Gets Root: Privilege Escalation in LLM Harnesses

Xingbang He, Yuanwei Chen, Yi Qian, Haiyang Wei, Ligeng Chen, Zenan Fu, Linzhang Wang, Hao Wu, Bing Mao

Abstract

Instruction hierarchy is a model-side defense that assigns instructions different levels of privilege according to their sources. These levels constrain which content may direct model behavior. During agent execution, however, agent harnesses construct context for each model invocation. This construction can elevate low-level content to a higher instruction level and grant it greater model-facing privilege. We introduce instruction privilege escalation. In this attack, an attacker induces an agent to elevate low-level malicious content to a higher instruction level. The elevated content then causes the agent to execute instructions it would not follow at their original level. We evaluate this threat by using multi-agent mechanisms to achieve 13 attack objectives across six coding-agent harnesses. These objectives span confidentiality, integrity, availability, and remote code execution. With unrestricted action execution, the attacks achieve all 13 objectives on all six harnesses. Under automatic permission review, the attacks achieve all 13 objectives on all three harnesses that provide this mode. We further reproduce the vulnerability using harness-provided persistent goals and scheduled tasks. These results demonstrate the generality of instruction privilege escalation.

1 Introduction

Recent advances in long-context understanding, instruction following, and tool use enable agents to operate in real-world environments and perform complex tasks, including coding, command execution, and routine workflows [15,20,36][15,20,36]. These capabilities also introduce security risks. Moreover, untrusted content from files, webpages, emails, or tool results can induce agents to take harmful actions, leading to data exfiltration, persistent modification, or remote code execution [17,18,34][17,18,34].

Modern agent harnesses commonly rely on two defenses against these risks. First, the working agent is trained to identify and refuse unsafe instructions. Second, a separate permission reviewer may assess whether proposed actions are authorized [7,16,22][7, 16, 22].

Both defenses rely on an instruction hierarchy [25, 38] that assigns different levels of instruction privilege to different sources. Models are trained to trust system- and user-level instructions more while treating tool-level content as less reliable. This hierarchy helps distinguish authorized instructions from malicious instructions embedded in external data. The working agent relies on role labels to determine which instructions should govern its behavior, while the permission reviewer uses role labels in the interaction history to infer who authorized an action and for what purpose.

Yet both defenses rely on a crucial assumption: the role labels faithfully reflect the true provenance of the content.

We find that this assumption is heavily flawed. When a harness delegates a task, resumes a persistent goal, runs a scheduled task, or loads a custom subagent, it may reconstruct context without preserving the content's original provenance. Tool-level content can become a user-level task or be persisted as system-effective policy. As a result, the working agent may follow tool-level instructions relabeled as user intent, while the permission reviewer may treat them as evidence of user authorization even when the resulting action is harmful.

We introduce a novel attack paradigm called instruction privilege escalation. In this attack, an attacker induces agent-side context reconstruction to elevate malicious content from a lower to a higher instruction level. We identify two forms of escalation: tool-to-user escalation, in which tool-level content is elevated to user-level instructions, and tool-to-system escalation, in which it is elevated to system-level instructions. The elevated content gains greater model-facing privilege and can alter subsequent decisions by the working agent or permission reviewer.

We realize these escalation types through several harness mechanisms. For tool-to-user escalation, we primarily exploit multi-agent delegation: a main agent forwards malicious tool-level content to a subagent, where the harness inserts it into the subagent's context as a user message. Persistent goals and scheduled tasks exhibit the same transition, reintroducing

*xingbanghe@smail.nju.edu.cn carried content as user messages. For tool-to-system escalation, we exploit custom subagents, where malicious tool-level content can be incorporated into a subagent's custom system prompt and later loaded as system-effective instructions when the subagent is invoked.

Instruction privilege escalation differs from both prompt-injection and role-confusion in how instruction privilege is manipulated. In prompt injection, malicious content remains at its original instruction level and attempts to make the model follow it [40, 43]. In role-confusion attacks, malicious content deceives the model into misinterpreting the message role, by mimicking model-generated reasoning or by formatting malicious payloads to imitate native chat templates [6, 9, 41]. In contrast, instruction privilege escalation does not rely on model-side role confusion. The harness itself places malicious content at a higher instruction level during context reconstruction. The downstream model therefore receives the malicious instruction under an actual user or system role in the model-facing context, rather than as low-privilege content that merely mimics such a role.

We evaluate instruction privilege escalation on six coding-agent harnesses across 13 attack objectives spanning confidentiality, integrity, availability, and remote code execution. Our results show that: (1) Coverage: instruction privilege escalation is reproducible across all six evaluated harnesses. (2) Effectiveness: under full-access execution, the attack achieves all objectives on every harness. (3) Defense Bypass: under automatic permission review, the attack still achieves all objectives on all three harnesses that support this defense mode. (4) Generality: beyond multi-agent delegation, we reproduce tool-to-user escalation through persistent goals and scheduled tasks, demonstrating that the vulnerability extends across multiple context-reconstruction mechanisms. We make the following contributions:

  • New Attack Paradigm: We introduce instruction privilege escalation to elevate malicious content from a lower instruction level to a higher one by using agent-side context reconstruction. We show that this breaks a shared provenance assumption underlying both instruction hierarchy and automatic permission review.

  • Attack Realization: We construct concrete tool-to-user and tool-to-system escalation attacks through multi-agent mechanisms, showing how malicious content can be elevated as higher-privilege instructions without relying on model-side role confusion.

  • Empirical Results: We evaluate tool-to-user escalation and tool-to-system escalation on six coding-agent harnesses across 13 attack objectives spanning confidentiality, integrity, availability, and remote code execution. Across the evaluated harness–permission configurations, tool-to-user escalation achieves a 97.3% mean success rate after escalation, while tool-to-system escalation achieves an 80.3% mean per-attempt attack success rate.

References (28)