When Answering Is Administering: Permission Replies That Rewrite Coding-Agent Policy

Summary (Overview)

  • Novel attack discovery: The paper demonstrates that in Claude Code and other LLM-based coding agents, a party trusted only to answer permission prompts can rewrite the operator's security policy through policy updates attached to their answers, effectively escalating from answering authority to administrative authority.

  • Formal bounds on safe delegation: The authors prove tight bounds on which policy updates a runtime can safely accept: without authorship records, a runtime can only accept updates that preserve the denied set of every reader; with authorship records, each party can lift only its own restrictions.

  • Cross-system validation: The theoretical bounds correctly predict safety outcomes across 13 permission designs in 10 agent systems (including Codex, Gemini CLI, opencode, and Goose), with 5 predictions recorded before running the systems.

  • Practical repair: A single validator at the shared update step blocks the attack while preserving honest answers, affecting only ~0.1% of marketplace plugins (2 out of 2,227 fetched).

  • Deployed vulnerability: ~7% of 70 surveyed deployed relays (including the vendor's own Remote Control) forward policy updates that can delete deny rules, and the attack succeeds through all four answer routes.

Introduction and Theoretical Foundation

Background

LLM-based coding agents (Claude Code, Codex, Gemini CLI) execute code on developers' machines, reading files, running shell commands, and fetching web pages. These agents use permission systems to gate tool calls:

  • Operator: The developer who writes allow rules (permitted calls) and deny rules (prohibited calls)
  • Answering parties: Security plugins, approval services, or mobile apps that answer permission prompts on the operator's behalf
  • Documented guarantee: An answer cannot override a matching deny rule (checked decision-by-decision)

The Core Problem

The documented guarantee fails over a whole run because an answer to one permission prompt can rewrite the policy that every later answer is checked against. The paper identifies that:

"The right to answer a prompt has become the right to administer the policy."

The root cause: Claude Code checks only updates that add or replace allow rules, while deletions of deny rules pass unfiltered. This violates the classic separation between authorization decisions and policy administration.

Key Theoretical Concepts

The paper formalizes policies using:

Definition 1 (Policies, readers, and answers):

  • A rule is a pair (b,p)(b, p) where b∈{allow,ask,deny}b \in \{allow, ask, deny\} is a behavior and pp is a pattern
  • A policy RR is a finite collection of rules
  • The denied set M(R)M(R) collects actions that some reader refuses
  • An answer is a pair (d,u)(d, u): a decision dd and an update uu (a function from policies to policies)
  • A filter is safe if for every initial policy R0R_0 and every run, no action in M(R0)M(R_0) is ever permitted

Methodology

Threat Model

  • Trusted: The runtime, operating system, and administrator's managed tier
  • Adversary: An answering party using one of four answer routes (plugin hook, prompt handler, SDK, remote bridge)
  • Goal: Perform an action denied by the operator's rules (e.g., reading protected files or sending them to its own host)
  • Key insight: The adversary needs no file access, no knowledge of the rules, and no code on the host

Formal Analysis

Theorem 1 (Without authorship records): (i) A filter that sees only the update is safe iff every admitted update satisfies M(u(R))⊇M(R)M(u(R)) \supseteq M(R) for every policy RR. (ii) A filter that also reads the rules is safe iff, whenever it admits uu at policy RR, M(u(R))⊇M(R)M(u(R)) \supseteq M(R).

Theorem 2 (What records buy): (i) A filter admitting update uu from party ee at RR iff M(u(R)c)⊇M(Rc)M(u(R)_c) \supseteq M(R_c) for every class c≠ec \neq e protects every class, and ee can lift every action that no other class's rules deny. (ii) If two parties share a class, no filter can both let one lift its own rules and keep the other's restrictions from shrinking. (iii) The per-step check is unsafe.

Theorem 3 (Saved answers): Let the operator's deny rules have ranks in a nonempty finite set DD. Saving answers is safe iff πk≤min⁡D\pi_k \leq \min D for every kk, or g(c)={c}g(c) = \{c\} for every call cc.

Proposition 1 (Complexity): Deciding whether deleting deny rules preserves the denied set is polynomial-time with one wildcard kind but coNP-hard with two or more.

Experimental Setup

  • Attack runs: Fresh home directories, two recent Claude Code releases, scripted and live models
  • Cross-system study: 14 agent runtimes examined, 10 systems with 13 designs analyzed
  • Filter monitor: Models the runtime's settings covering tiers, destinations, and sandbox readers

Empirical Validation / Results

Attack Effectiveness (RQ1)

The attack succeeded on every route tested:

AnswerRelay to serviceSDK callbackDeployed relayPlugin hookURL-only pluginSkill in checkoutLive modelsEvery tier replacedManaged tier
Removal attached6/66/66/66/66/66/624/246/60/6
Allow only0/60/60/60/60/60/60/240/6*—

Policy Updates vs. Rewritten Calls (RQ2)

Under the strict sandbox, policy updates exposed protected files where rewritten calls failed:

SandboxRewritten call: Read .envRewritten call: Write settingsRewritten call: Leave sandboxPolicy update: Remove denyPolicy update: Allow only
Off6/66/6—6/60/6
Strict0/60/60/66/60/6

Cross-System Prediction (RQ4)

The three facts (what a party may change, how checks combine rules, whether authors are recorded) predicted all 13 outcomes correctly:

Safe designs: Gemini CLI extensions (labeled rules), Progent (SMT-checked narrowings), VS Code Copilot agent (deny first), Claude Code managed tier and session-only mode

Unsafe designs: Claude Code default answers, Goose (ACP client), Copilot SDK, opencode 1.19, Gemini CLI answers, DeepSeek Harness, Koishi

Repair Effectiveness (RQ6)

FilterFigure 3(b) traceViolated runs of 20,000Via sandboxAdmitted updates (%)Own liftsTime/decision (μs)
Shipped✗12,4989,819100.0—0.2
Per-step check✗8,3378,20193.2—688.2
Deny-only✓8,1588,15877.6—0.3
Sees update✓0065.000.4
Reads rules✓0080.201,188.5
Records authors✓0079.31471,205.4
Checks labels✓0070.91424.8

Plugin Compatibility

Only 2 of 2,227 fetched marketplace plugins send policy updates, and both would continue working under the repair.

Theoretical and Practical Implications

Design Guidelines

  1. Classify updates by effect: Judge updates by their effect on what each reader refuses, not by syntax. A deletion or replacement of deny rules is a grant.

  2. Record authorship: Record the author of each rule written through an answer, keeping the record out of answering parties' reach. Only this enables parties to undo their own rules.

  3. Refuse whole answers: When an update is refused, refuse the entire answer, not just the update portion.

Broader Significance

  • Confused deputy problem: The runtime performs the write, making a party barred from operator's files gain write access to the operator's rules and sandbox limits
  • Attribution failure: Deletions leave the same records as local operator edits, making changes indistinguishable
  • Non-monotonicity: Access-control languages with deny rules are not monotone; the paper characterizes what giving up monotonicity costs for updates

Conclusion

The paper demonstrates that answering a permission prompt in coding agents effectively confers the power to administer the security policy. The key findings:

  1. Attack: A single answer can delete deny rules and widen sandboxes, persisting across sessions
  2. Bounds: What a runtime records determines how much it can safely delegate
  3. Predictive power: Three facts about a design predict safety across ten agent systems
  4. Repair: A single check at the shared update step blocks the attack with minimal plugin impact

Future directions include:

  • Extending the analysis to other state that authorization decisions read (hook configurations, MCP server settings, instruction files)
  • Adopting authorship records through per-party settings tiers or signed rule entries
  • Solvers for the coNP-hard coverage check
  • Automated extraction of the three predictive facts from runtime source code

Related papers