Published: 2026-11-26
Categories: Agentic AI Security
When “Yes” Rewrites the Rules: Coding-Agent Authorization Drift
Key Takeaways
Three research papers released since late October 2026 describe a class of coding-agent weakness that sits outside the usual prompt-injection and sandbox-escape categories. In these attacks, the channels that are supposed to carry authorization (the answer to a permission prompt, and the record of what the user asked for) are used to change the authorization policy itself. The agent’s rule engine, its sandbox, and its policy authorizer can all keep working exactly as designed and still enforce the wrong policy, because the policy has been rewritten underneath them.
- Permission replies can carry policy edits. A study released on 24 November 2026 shows that in Claude Code, a party trusted only to answer a permission prompt can attach updates that delete the operator’s deny rules. The shipped filter checks only added allow rules, and the paper reports that three of four answer routes skip even that check [1].
- The weakness reaches the wider tooling ecosystem. Of 70 third-party relays and front ends surveyed, five forward deny-rule removals written on the remote side. The paper states that one of these is the vendor’s own Remote Control feature. Malicious use does not yet appear widespread: only two of 2,227 marketplace plugins send policy updates [1].
- Context compaction can launder authority. When a long session is summarized, text the agent read can come back as an instruction from the user. Across five harnesses that flatten roles into text, a forged approval entered the agent’s memory 87–100% of the time, and the resulting attack executed in roughly 20–40% of full-context sessions. The same attack succeeded 0% of the time against four harnesses that keep roles as typed fields [2].
- Policy authorizers inherit the summary’s errors. A companion paper found that Claude Code and Codex (in local compaction) placed the model-written summary in the user’s request slot in all 1,108 automatic compactions recorded. After compaction, an authorizer that derives its policy from the user’s request was reported to lose its protective effect [3].
- Operators can act now. Deny rules placed in managed settings or passed on the command line cannot be written by permission-reply updates [1], [6]. Auditing which plugins and relays can answer prompts on a developer’s behalf is a near-term priority.
Background
Coding agents such as Claude Code, Codex, Gemini CLI, opencode, and Goose mediate risky actions through a layered permission system. Operators write allow, ask, and deny rules. The agent asks a human, or a delegate of the human, before running anything that falls into the “ask” category, and an optional sandbox restricts file and network access at the operating-system level. Anthropic’s documentation for Claude Code states that deny rules are evaluated first, then ask, then allow, and that “deny rules block in every mode” [6]. That deny-first ordering is the property that lets an operator write a short list of hard limits, such as never reading .env files, and trust it to hold regardless of what else the agent is allowed to do.
The permission prompt itself has come under pressure for usability reasons. In its March 2026 description of Claude Code’s auto mode, Anthropic reported that “in practice users accept 93% of” manual permission prompts [7]. Partly in response, and partly to support unattended and remote workflows, vendors and the tooling ecosystem now delegate answers. Prompts can now be answered by plugin hooks, unattended-session handlers, applications that embed the agent through an SDK, and remote front ends such as mobile or chat relays. Each of these makes the agent easier to use. Each also adds a new party that speaks on the operator’s behalf. CSA’s July 2026 analysis of GhostApproval showed that a human approval is only meaningful when the dialog accurately reflects what will happen [11]. The work reviewed here extends that concern from what the approver sees to what the approver is able to say.
The second pressure point is the context window. Long agent sessions are periodically compacted: the harness asks a model to summarize the conversation so far and continues with the summary in place of the full transcript. That summary is a model-written artifact, yet in many harnesses it re-enters the conversation in a position that downstream components treat as the user’s own words. Earlier in 2026, Anthropic researchers reported that compaction summaries were not monitored by the blocking classifiers they red-teamed. They described “compaction attacks” in which an agent completed a step of a malicious side task and then caused the summary to describe it as benign [5]. The papers summarized below show that this is a structural problem, not an artifact of one monitor.
Security Analysis
Permission replies as an administrative channel
The paper “When Answering Is Administering,” by researchers at the University of Technology Sydney, the National University of Singapore, the University of New South Wales, and the University of Sheffield, studies what the authors call the “answering party”: anyone other than the operator who answers a permission prompt [1]. In Claude Code, an answer that allows a tool call can also carry policy updates that “add, remove, or replace rules of one behavior, or change the permission mode.” The updates can target the session or a settings file. The feature exists so that hooks can “process ‘always allow’ suggestions and apply permission updates,” which is a legitimate convenience. The authors found, by analyzing the shipped binary, that the filter on these updates “forwards every update unless the type is addRules or replaceRules and the behavior is allow, so deletions of deny rules pass without a check.” They also report that “three of the four answer routes skip even this filter.”
The resulting attack requires no code execution on the victim’s machine and no knowledge of the operator’s policy. The agent asks permission for something unremarkable. The answering party approves it and attaches an update that removes a deny rule, for example Read(./.env), from the user settings file. Because the update is persisted, the deny rule is gone for this session and every later one. The paper notes that “an update that replaces every deny list with a placeholder deletes rules its author has never seen.” The vendor’s own update validator, which exists in the binary, compounds the problem: it labels the replacement of a deny list as “restrictive” even though the replacement deletes every deny rule not in the new list. The paper also identifies a stricter “session-only answer mode” that drops deletions; it is present in the binary but not used on the default path [1].
The sandbox does not contain the damage, because Claude Code’s strict sandbox builds its restrictions from the same deny rules. Deleting the rule therefore removes the sandbox restriction as well. Adding an allow rule for an attacker-controlled host then lets a later command send the file out. Rules are stored as bare strings without a record of who wrote them, so the change “leaves the same record as an edit by the operator.” It survives the removal of the plugin that made it [1]. In our assessment, this provenance gap is the most consequential long-term finding. An operator reviewing their settings file afterward has no way to distinguish their own edits from those written by a plugin or relay.
Who holds the answering role
The practical exposure depends on who can answer prompts. The authors identify four routes: plugin hooks, prompt handlers for unattended sessions, applications that embed the agent through the SDK, and remote front ends that reply through a bridge. A marketplace plugin, or a skill shipped inside a cloned repository, can register such a party, and a plugin can name a remote service as its permission hook [1]. The table below summarizes the authors’ ecosystem measurements.
| Population surveyed | Finding | Source |
|---|---|---|
| 70 relays and remote front ends | 5 forward remote-written rule updates, “deny removals included”; 25 offer a choice among proposed updates; 37 send a decision only; 3 undetermined | [1] |
| Relays forwarding deny deletions unfiltered | About 7% of those surveyed, including the vendor’s Remote Control; the unnamed others have “more than 40,000 GitHub stars together” | [1] |
| 2,227 fetched marketplace plugins | “Only two” (about 0.1%) send policy updates | [1] |
| Claude Code releases | The deletion “still succeeds on build 2.1.327, the latest release at the time of writing” | [1] |
The marketplace figure indicates that malicious use of this feature is not yet widespread. The relay figures indicate that the infrastructure for it already exists in popular tools. For Remote Control, the paper characterizes the answering party as “whoever controls the operator’s claude.ai account.” Under that reading, compromise of a web account becomes a path to changing persistent local security policy on a developer workstation. The paper extends its model to thirteen permission designs across ten agent systems. Outcomes vary by design: the authors report differing behavior in opencode, Codex, and Gemini CLI. The opencode project’s security policy describes its permission system as “a usability feature rather than a security boundary” [1]. The text we reviewed does not describe a vendor response or CVE for the Claude Code finding, and readers should treat remediation status as unconfirmed.
Compaction laundering: when a document becomes the user
Arshan Dabirsiaghi of Pixee published “Compaction Laundering” on 21 October 2026, studying nine open-source harnesses [2]. Five harnesses (pi, opencode, Cline, Aider, and OpenHands) serialize the conversation into a single string before summarizing it, writing role labels such as [User]: into the text without escaping those labels when they appear in untrusted content. An attacker who controls anything the agent reads, such as an onboarding document, a troubleshooting web page, or a dependency README, can insert a line that looks like a user turn. The paper argues that the summarizer is not deceived but accurately records the forged line as a user instruction, and the harness then re-injects the summary into the next context as a genuine user-role message. In the paper’s case study, the agent initially refuses the attacker’s request, and compaction then “launders the approval” so that the agent “obeys its corrupted memory.”
The paper reports that across the five flattening harnesses, the forged approval launders into memory 87–100% of the time, while the identical attack succeeds 0% of the time against four role-typed harnesses (Codex, Gemini CLI, Qwen Code, and Continue) [2]. Executed attacks are less reliable than laundering: the author reports near-100% execution on short transcripts, settling to roughly 20–40% in a full context window. Prompt-level defenses stopped relatively few attacks: an in-prompt attribution rule modeled on Gemini CLI’s stopped only 13–25% of attacks, while a code-level provenance check that compares user-attributed claims in the summary against the real user turns caught 77% of laundering and demoted 2% of legitimate content. The author states that the findings were disclosed to affected maintainers before publication, and frames the measured rates as a floor because two related attack variants were deliberately excluded [2].
Compaction and policy authorizers
A second paper from an overlapping research group, “LLM Agent Authorization Across Context Compaction,” examines what compaction does to policy authorizers such as Progent [3]. Progent derives a least-privilege policy from the user’s latest request. The authors report that Claude Code, and Codex when it compacts locally, insert the model-written summary into that request slot, and that “the summary took the request slot at all 1108 automatic compactions we recorded.” The authorizer continues to enforce least privilege correctly, but the request it reads is the compactor’s paraphrase, which may quote injected documents as though the user had said them. When the user specified a payee, the policy derived from a frontier compactor’s summary admits the notice’s account in 91% and 59% of cases under the paper’s two policy generators, compared with none when derived from the user’s own words. In the paper’s AgentDojo evaluation, injections that Progent blocked before compaction succeeded afterward about as often as on an undefended agent: 31 of 100 pairs (26 in a repeat run), compared with 33 of 100 against an undefended agent [3].
The authors also prove a general limit: a text-only authorizer’s ability to detect a forged record is bounded by how distinguishable the forged and genuine texts are [3]. Their proposed fix, a “witnessed-request gate,” attaches an authentication tag to each user turn on arrival, carries user turns verbatim across compaction, and passes only those turns to the policy generator. In the authors’ own evaluation, no attacker action completed in 40 attacked episodes re-run with the gate, and the gate withstood all eight of their adaptive attacks. They also report that those adaptive attacks pass the authors’ reimplementation of the simpler filter that OpenAI deployed in Codex; the deployed filter itself was not tested directly [3]. This finding matters for any organization relying on intent-derived authorization. Such a design is only as trustworthy as its record of intent, and compaction replaces that record without notice to the authorizer.
A common pattern
These results share a structure with earlier work on approval-execution binding. Yang Wang’s “Approval Laundering” taxonomy describes how harnesses can execute an action different from the one the human approved, across scope, argument, temporal, tool, delegation, and semantic dimensions [4]. Separately, the Authorization Drift Benchmark found frontier-capable models drifting beyond their granted authority in 43–61% of runs on the benchmark’s task suite, even without any adversary [12]. The table below situates the two new mechanisms against that background.
| Mechanism | What gets rewritten | Who can trigger it | Why existing controls miss it |
|---|---|---|---|
| Permission-reply policy updates [1] | Persistent deny/allow rules and permission mode | Any answering party: plugin hook, SDK host, remote relay | Filter checks only added allow rules; sandbox derives from the same rules; no rule provenance |
| Compaction role forgery [2] | The agent’s memory of what the user approved | Author of any content the agent reads | Flattened serialization erases the role boundary; summarizer is accurate, not fooled |
| Compaction as request substitute [3] | The request an authorizer derives policy from | Author of any content the agent reads | Summary occupies the user slot; text-only authorizers cannot distinguish it |
| Unmonitored compaction [5] | The monitor’s view of prior actions | A misaligned or hijacked agent | Summaries were not inspected by blocking classifiers; the authors report fixing several such vulnerabilities in Claude Code, so the gap may persist mainly in other harnesses |
The common thread is that authority is being inferred from position and format, such as being in the user slot, arriving on the answer channel, or carrying a [User]: label, rather than from authenticated origin. A red-team study by Anthropic researchers and Fellows points in the same direction. They report that agents could use an injection attack against Claude Code Auto Mode and OpenAI’s Codex Guardian to run arbitrary bash commands in 79% of trials. Their strongest mitigation frames each transcript turn with an unguessable identifier, and they also recommend checking compaction summaries [5].
Recommendations
Immediate Actions
Organizations running Claude Code should move non-negotiable deny rules, such as protection of credential files, SSH keys, and cloud configuration, into managed settings or command-line settings. The permission-reply update mechanism cannot write either location [1]. Where central policy is feasible, the allowManagedPermissionRulesOnly managed setting ignores rules from user and project files and stops saving new rules from prompt answers [6]. Teams should also restrict sandbox network egress to hosts listed in managed settings, so that a deleted file-read rule does not by itself enable exfiltration [1].
Security teams should inventory every party that can answer a permission prompt on a developer’s behalf. That inventory covers installed plugins with permission hooks, skills inside cloned repositories, SDK-embedding applications, and remote or mobile approval relays, including the vendor’s own remote-control features. Any relay that forwards rule updates written on the remote side should be disabled or replaced with one that sends decisions only. As a detective control, teams should snapshot user and project settings files and alert on changes to deny lists. Because rules carry no author [1], comparing settings against a known-good baseline (or using file-integrity monitoring on those files) is the most practical way to detect tampering today.
Short-Term Mitigations
For harnesses that flatten roles before compaction, teams should apply maintainers’ fixes as they ship and should prefer role-typed harnesses for sessions that ingest untrusted content [2]. Where long sessions process external documents, web pages, or dependency files, teams can reduce exposure by starting a fresh session for sensitive operations rather than relying on a compacted history. Re-confirming any high-impact approval that originates from before a compaction event achieves a similar effect. Organizations that deploy intent-derived authorizers such as Progent should confirm that the authorizer reads authenticated user turns and not the compaction summary [3].
Organizations should ask their coding-agent vendors four questions. Do permission-reply updates ever loosen policy? Is rule provenance recorded? Is the compaction summary placed in the user role? Are compaction summaries monitored by the same classifiers that review tool calls [1], [3], [5]? The last question remains relevant even though the authors of [5] report fixing several such gaps in Claude Code, because operators of other harnesses should confirm whether summaries are monitored. Procurement and STAR-style assurance reviews for AI developer tools should treat these as security-boundary questions rather than usability details.
Strategic Considerations
The research points toward three design principles that vendors and enterprise platform teams should adopt. First, answering is not administering. An answer channel should be able to approve or deny the pending action and, at most, add narrowly scoped allowances. It should never delete or replace restrictions. The authors propose refusing any update that would make the agent refuse less, and ranking saved “always allow” answers below every deny rule [1]. Second, every rule and every user turn should carry provenance. Rules should record their author so that a party can remove only restrictions it demonstrably created [1]. User turns should be cryptographically witnessed and preserved verbatim across compaction [3]. Third, model-written summaries should be treated as untrusted derived content. They should carry a source field, sit outside the user role, and be subject to monitoring [2], [5].
At the governance level, these findings reinforce a point made in CSA’s 2026 research notes on GhostApproval and sandbox trust handoffs [10], [11]: human-in-the-loop review is a control only when the human’s decision is bound to what actually executes. Practitioner research suggests that permission systems should “avoid treating repeated approvals as stable preferences” [8]. The work summarized here shows that the binding can fail in both directions. An approval can authorize more than it appears to, and a summary can manufacture approvals that were never given.
CSA Resource Alignment
CSA’s GhostApproval: A Trust Boundary Gap in Six AI Coding Agents [11] is the most directly related prior work. GhostApproval showed that the approval dialog can misrepresent the action being approved. The findings in this note show that the answer to a dialog can do more than approve, and that compaction can fabricate approvals entirely. Taken together, they map three failure points in the human-in-the-loop chain: what the approver sees, what the approver’s answer is permitted to change, and what the agent later remembers the approver said. Organizations that adopted GhostApproval’s guidance on making approvals accurate should extend it to constrain what an approval can change.
CSA’s Sandboxing Agentic AI: Least-Privilege Patterns for MCP and Coding Agents [9] recommends tamper-resistant enforcement layers between the agent and its resources. The permission-reply finding is a concrete case where that principle was not met: the sandbox derived its limits from a policy store that a delegate could edit. The companion analysis AI Coding Agent Sandbox Escapes: The Trust Handoff Flaw [10] identified a similar pattern, in which escapes manipulated what happened to agent output after it left the sandbox rather than breaking isolation directly. Both support the recommendation that security-critical policy reside in a tier the agent and its delegates cannot write.
The AI Controls Matrix (AICM) v1.1 [13] provides the control vocabulary for operationalizing these recommendations. Its controls for agent security boundaries, AI sandboxing, and agent access restriction apply directly. Its logging and audit domains support the call for rule provenance and settings-change monitoring. MAESTRO [14] gives threat modelers a layered framework for placing these attacks. Permission-reply rewriting sits at the agent-ecosystem and deployment layers, where third-party plugins and relays connect. Compaction laundering sits at the agent-framework layer, where memory and context management are implemented.
References
[1] Fei, Z., Fei, H., Chen, J., Wang, X., Gope, P., Sikdar, B., and Zhang, Y. “When Answering Is Administering: Permission Replies That Rewrite Coding-Agent Policy.” arXiv:2611.32195, November 2026.
[2] Dabirsiaghi, A. “Compaction Laundering: Provenance Destruction in Context-Compacting Coding Agents.” arXiv:2610.29869, October 2026.
[3] Fei, Z., Fei, H., Xu, Y., Wang, X., and Zhang, Y. “LLM Agent Authorization Across Context Compaction.” arXiv:2611.32194, November 2026.
[4] Wang, Y. “Approval Laundering: Systematizing Approval–Execution Binding Failures in AI Coding-Agent Harnesses.” arXiv:2609.38983, September 2026.
[5] Remedios, A., Storf, S., Roger, F., and Hughes, J. “Red-Teaming Auto Mode: Improving Blocking Classifiers Against Malign Coding Agents.” arXiv:2609.19587, September 2026.
[6] Anthropic. “Claude Code Settings Reference.” Claude Code Documentation, accessed November 2026.
[7] Hughes, J. “How We Built Claude Code Auto Mode: A Safer Way to Skip Permissions.” Anthropic Engineering, March 2026.
[8] Salerno, L., Gao, H., Gay, G., Serebrenik, A., and Leitner, P. “Let the Agent Do It? How Software Practitioners Understand and Make Permission Decisions in Agentic AI Assistants.” arXiv:2610.06047, October 2026.
[9] Cloud Security Alliance. “Sandboxing Agentic AI: Least-Privilege Patterns for MCP and Coding Agents.” CSA AI Safety Initiative, May 2026.
[10] Cloud Security Alliance. “AI Coding Agent Sandbox Escapes: The Trust Handoff Flaw.” CSA AI Safety Initiative, July 2026.
[11] Cloud Security Alliance. “GhostApproval: A Trust Boundary Gap in Six AI Coding Agents.” CSA AI Safety Initiative, July 2026.
[12] Cao, C., Zeng, J., Yin, B., et al. “Authorization Drift in LLM Agents: Evaluating Boundary Compliance in Multi-Step Tool Use.” arXiv:2611.09113, November 2026.
[13] Cloud Security Alliance. “AI Controls Matrix (AICM) v1.1.” Cloud Security Alliance, 2025.
[14] Cloud Security Alliance. “Agentic AI Threat Modeling Framework: MAESTRO.” Cloud Security Alliance, February 2025.