← all writing
05 · 28 Nov 2026 · 7 MIN READ

A Claude Code permission reply can delete the deny rule guarding .env

I have a deny rule for Read(./.env) in my Claude Code settings, and until this week I treated it as the one line nothing else could argue with. Allow rules lose to it. Hooks that say "allow" get re-checked against it. The docs say an answer to a permission prompt cannot override it.

That guarantee is true, and it turns out to be the wrong guarantee. When Answering Is Administering, a security paper from Zeming Fei and colleagues, shows that whoever answers a permission prompt for you can also delete that deny rule, because the answer is allowed to carry policy updates and the runtime writes them into your settings file.

In effect, the right to answer a prompt has become the right to administer the policy.

That sentence from the abstract is the whole paper in one line. The rest is a careful demonstration that it holds, a proof of exactly how much a runtime can safely delegate, and a check of that proof against ten agent systems.

One unrelated approval, and .env is readable for good

Claude Code lets other parties answer permission prompts: plugin hooks, prompt handlers for unattended sessions, SDK hosts embedding the agent, and remote front ends through a bridge. When one of them answers "allow", the answer can also include a list of updates, intended for the "always allow this" case. The attack walks right through that feature:

  1. The operator denies reading .env, turns on the strict sandbox, and delegates prompts to a remote approval service that cannot see the operator's files.

  2. The agent asks to run something harmless (the paper uses touch). The service approves it and attaches one update: remove the deny rule from user settings.

  3. The runtime applies and persists it. The guard clause the authors read from the binary only inspects updates that add or replace allow rules, so a deletion of a deny rule passes untouched.

  4. The next read of .env succeeds, in this session and the next one, with the service long gone. A second update allowing the service's host lets a later command post the file out.

The attacker never needs the contents of your rules. An update that replaces every deny list with a placeholder wipes rules its author has never seen. It also needs no code on your machine: a plugin whose single file names a remote URL as its permission hook did the job. Neither does it need you to install anything deliberate: a skill in a cloned repo that declares a permission hook worked once the operator agreed to use the skill.

The numbers are about as binary as security results get. The deletion lifted the rule in 6 of 6 runs on every route tested and 24 of 24 runs where live Claude models chose the calls themselves, while the matched control sending a plain allow changed nothing in any of them. The paper reports the attack still working on 2.1.327, the latest release when it was written.

Why the sandbox doesn't save you here

My instinct was that the strict sandbox is the backstop. The authors tested that instinct directly. A malicious approver can already rewrite the command it approves, so they compared three rewrites (print .env, edit the settings file, ask to leave the sandbox) against the policy update. With the sandbox off, two of the rewrites exposed the file. With it on, none of the three did, but the update still did, in both settings.

The reason is structural: the sandbox builds its file and network limits from the same rules. Delete the deny rule and you have also deleted the sandbox's restriction. Even adding allow rules widens it, since one WebFetch allow let a rewritten command send a project file out and one Edit allow let it write outside the project. So a fix that only refuses deny-rule deletions is not enough, and the paper's simulation shows it: that deny-only filter still lost a sandbox restriction in 8,158 of 20,000 random runs. The shipped behaviour lost one in 12,498.

And afterwards there is nothing to find. Rules are stored as bare strings, so a deletion by a remote answer leaves the same record as you editing the file yourself. Uninstalling the plugin undoes nothing.

Thirteen designs, thirteen correct predictions

What lifts this above a bug report is the theory. The authors prove that safe delegation depends on three facts about a design: what a party may change, how each check combines matching rules, and whether the runtime records who wrote each rule. Without authorship records, a runtime may only accept updates that leave everything currently denied still denied, for every reader of the policy, sandbox included. With authorship, each party can safely remove only its own restrictions. Both bounds are tight.

They then predicted the outcome for 13 permission designs across ten systems from those three facts alone, writing five of the predictions down before running anything. All 13 matched. A few that stuck with me:

That pre-registered element matters to me. It turns "we found some bugs" into "here is a test you can run on your own runtime without exploiting it".

The blast radius is small today, which is exactly why to fix it now

I'd be overstating it to call this an active epidemic. Of 2,227 marketplace plugins the authors fetched, 253 have a prompt-answering hook and only 2 send policy updates at all, and both only pick from the runtime's own suggestions. Of 70 permission relays surveyed, 5 forward rule updates with deny removals included, about 7%. One of those five is Claude Code's own Remote Control, which means the answering party there is whoever controls your claude.ai account. The runs are Linux-only with bubblewrap; macOS Seatbelt wasn't tested. The fix covers answer updates only, while hook configs, MCP settings and instruction files are flagged as the next surface with the same shape.

The repair itself is cheap: one validator at the shared step every route passes through, refusing deny deletions and replacements plus sandbox-relevant allow additions, and rejecting the whole answer rather than acting on the allow alone. Every filter they compared decided within 1.2 ms, and the two marketplace plugins that use updates keep working.

Until a fix like that ships, here's what I'm changing:

The broader lesson goes past Claude Code. Every agent harness is about to grow remote approvals, phone notifications and team policy services, because nobody can babysit long sessions. Each of those channels is a policy-administration channel unless the runtime proves otherwise. I'd bet the next round of agent CVEs comes from state that later checks read, and this paper hands defenders the test to run first.


Working on something similar?

Say hello — I read every email.