When Context Gets Root: Privilege Escalation in LLM Harnesses

An attacker who can only write files into a repository — no jailbreak, no prompt injection, no compromised component — reliably makes six different coding agents install root CAs, exfiltrate secrets, and stand up command-and-control shells. The mechanism isn't a model failure. It's the harness.

The Problem: Defense Relies on a Label That Harnesses Rewrite

Every agent framework defends with an instruction hierarchy: system commands outrank user requests, which outrank tool output. Models are trained to obey higher-privilege text and treat tool results as data. When an agent reads a malicious README, the content enters at the tool level — where the model is trained to distrust it. But the hierarchy is only as good as the role labels the harness assigns. This paper from Nanjing University shows that harnesses silently relabel content as they reconstruct context — and that's the whole game.

The Method: Instruction Privilege Escalation

The authors map every model API message type (tool, user, system-effective) onto one privilege ladder, then show that normal harness operations lift attacker content up it. Tool-to-user escalation happens through subagent delegation: the main agent forwards a task, and the harness inserts it into the subagent's context as a user message. Persistent goals and scheduled tasks do the same — content stored at tool level is re-delivered later as user input. Tool-to-system escalation happens through custom-subagent installs: attacker-controlled config becomes system-prompt material loaded on every invocation. Crucially, no role confusion tricks the model — the harness itself assigns the privileged label, so both the working agent and the automatic permission reviewer (Auto PR) faithfully do what they were trained to.

flowchart LR
    A[Tool-level repo content] --> B{Harness operation}
    B -->|subagent delegation| C[User-level message to subagent]
    B -->|persistent goal| D[Re-sent as user instruction]
    B -->|scheduled task| E[Delivered later as user message]
    B -->|custom subagent install| F[System-effective prompt]
    C --> G[Working agent executes]
    D --> G
    E --> G
    F --> G
    G --> H{Auto PR reviews}
    H -->|'user' role in transcript| I[Approves as user-authorized]

The motivating case is stark: told directly to start a backdoored server (tool-level), Codex GPT-5.5 refuses. Told the same thing via delegation (user-level), a subagent says "I will run the server script directly." Auto PR flags the action as high-risk but approves it — because the reconstructed transcript shows "the user explicitly approved this exact action." The labels lie; nothing else does.

The Numbers

Limitations — Read These First

Why Someone Building Things Should Care

If you ship any agent with delegation, goals, or scheduled tasks, this paper is a bug class with your name on it. Every place content crosses a message-type boundary is a privilege boundary — and most harnesses treat those transitions as bookkeeping. Audit delegation as a security-sensitive operation: provenance must survive reconstruction, and Auto PR must ask where a "user" instruction came from, not just what role label it carries. The paper's cleanest lesson: the instruction hierarchy is only as strong as the harness's relabeling discipline. The model did its job. The harness undid it, faithfully.