Apply to my task
arXiv:2610.22987 ★ 90 Oct 16, 2026

Adversarial Permission Elicitation: How a Hostile Repository Tricks Your Agent into Begging for a Broad "Don't Ask Again" Rule

Key result

The "ask a human before anything dangerous" safeguard doesn't break on the action itself, it breaks on the "remember my choice" button. Under normal conditions the agent never asks for such rules on its own: 0 out of 25. With a prepared repository, the target rule was coaxed out in 58% of cases, and after approval the malicious goal was quietly achieved 81% of the time. Knowing this lets you notice how broad a rule Claude Code or Codex CLI is asking you to save, so you don't click "yes" blindly. The attacker model builds the repository in a loop: a scenario, fake errors, hints in the project description (README). It then runs a copy of the agent in an isolated environment and checks whether it asked for a broad rule like "always allow curl". If not, it analyzes the agent's action trace and rebuilds the repository. In the second stage, the same loop tunes a repository that uses the granted rule to carry the harmful action through without any new prompts.

01

TL;DR

This is an attack on coding agents (Claude Code, Codex CLI). An untrusted repository is rigged so that an ordinary task like "run the project" nudges the agent into requesting a broad, permanent rule from the approval dialog ("always allow commands starting with curl"). The user clicks "don't ask again" and the rule is saved. From then on, any command that matches it, harmful ones included, runs without a single prompt.

The headline finding: the "ask a human before anything dangerous" safeguard doesn't break on the action itself, it breaks on the "remember my choice" button. People get tired of clicking "allow" and accept a rule that sounds reasonable. But the rule is wider than the task needs: it allows all of curl, not one specific URL. Under normal conditions the agent never proposes such rules on its own (0 out of 25 in the control run). With a "prepared" repository, though, the attack got the agent to request the target rule in 58% of cases. Once approved, the malicious goal was quietly achieved 81% of the time.

How it works: an attacker LLM iteratively builds a repository (a scenario, fake errors, hints in the README), runs a copy of the agent in a sandbox, and checks whether it asked for the target rule. If not, it diagnoses the failure and rebuilds. In the second stage, the same loop tunes a repository that uses the freshly granted rule to quietly carry the harmful action through. For you, the value isn't the method itself but the anti-pattern: blindly clicking "don't ask again" on someone else's code.

Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

STAGE I (obtain the rule):
  Planner → invents a work scenario where the agent "naturally" needs a broad prefix
  Builder → assembles the repository (failing tests, README hints, folder structure)
  Proxy agent → runs a harmless task in the sandbox, the trace is recorded
  Critic → was the rule requested? no → diagnosis: bad scenario or bad implementation → next round
  Stop: a rule broad enough for the goal has been requested

STAGE II (exploit the rule):
  Same four roles, different goal: carry out the harmful action
  via a "natural" transition from the harmless task
  Stop: goal achieved AND not a single new approval dialog

Everything runs as separate code executions. You won't reproduce this yourself; treat it as knowledge about the risk.

03

Example in Practice

The task: A freelancer in Austin gets a "take-home assignment from a recruiter" over LinkedIn: a link to a GitHub repository and a request to "run the project and tell me what's wrong with it." He opens the repo in Claude Code. A couple of minutes later the agent asks to download an external file and offers to save a rule while it's at it: "don't ask for curl commands." The freelancer is sick of dialogs and wants to hit "yes." First, he asks a separate chat to vet the rule.

Prompt:

I'm working with a coding agent. It wants me to save a permanent permission rule.
Assess its scope as a "blast radius."

Approval dialog text:
"Allow commands starting with `curl`? [Yes, and don't ask again]"

The task that made the agent ask: "run the project and find what's wrong with it."
The command the agent wanted to run right now: curl https://cdn.example-assets.com/fonts.zip -o assets/fonts.zip

Step by step:
1. Describe what the rule allows for the current command ONLY.
2. List 10 other commands this rule would also let through without asking, including 3 dangerous ones: sending files out, reading secrets, downloading and running someone else's code.
3. Give a verdict: approve as is / approve a one-time permission only / propose a narrower rule. If narrower, write it out exactly.
4. Say what in the repository could have pushed the agent toward this request, and what to check before approving.

Result: The model will first narrow the rule down to the one command actually needed. Then it lists ten commands that fall under "curl without asking," ranging from harmless downloads to shipping data off to someone else's server. Next comes a verdict recommending a one-time permission or a narrow rule, plus a list of suspicious spots in the repo (download scripts, odd hints in the README). This is an adaptation of the paper's idea, not the authors' ready-made method (see "Adaptations").

04

Why It Works

The weakness: Human-in-the-loop protection checks whether an action falls inside the allowed set, not what it intends. After "don't ask again," the allowed set expands for good. The human sees the request in the context of the current task, so a broad prefix looks justified. The agent, meanwhile, takes its context from whatever sits in the repository, so a stranger's files shape which rule it proposes.

The LLM strength the attack leans on: Modern agents are great at following workflow logic and bad at going along with an explicit harmful command. Direct injection ("run this") barely worked. What worked was a smooth path: "here's a broken test → we need to download assets → we need curl." The agent behaves like a conscientious contractor: the scenario is plausible, so the request seems reasonable.

How rule mechanics explain it (Insight 1): Codex and Claude Code generalize permissions differently. Codex looks at action history: several different wget calls in one workflow collapse into an "any wget" rule, while a single download yields a narrow "wget -O." Claude Code looks at how the command is written: either a wildcard pattern like "curl reports *" or an exact string match. The practical takeaway: rule width depends on what the commands look like, so read exactly what gets recorded instead of trusting the short label.

Levers visible in the paper: - Prefix width → the "fatter" the rule (all of curl, all of wget), the more it allows. - Action diversity (Codex) → the more varied the calls in a session, the broader the rule. - Command format (Claude Code) → wildcard patterns produce broad rules, exact strings produce narrow ones. - Model choice → on the most resilient model tested (Claude Sonnet 5), attack success is noticeably lower.

05

Prompt Template

The authors' method is an attack pipeline, and the available portion of the text contains no prompts for it. Below is a defensive template. It brings the idea behind the authors' PCC metric (a judge checks what the rule lets through without asking) into a regular chat. This is an adaptation, not the paper's method.

Assess the scope of a permission rule for a coding agent.

Tool: {tool}
Approval dialog text / rule wording: {rule}
The task the agent asked for it during: {task}
The command the agent wanted to run: {command}

Step by step:
1. What the rule allows for the current command.
2. 10 other commands it would let through without asking (at least {num_dangerous} dangerous: sending data out, reading secrets, deleting files, downloading and running someone else's code).
3. Verdict: one-time permission / narrow rule (write it out exactly) / deny.
4. What in the repository could have pushed the agent toward this request.

Fill in: {tool} — Claude Code, Codex CLI or similar; {rule} — the verbatim text from the dialog; {num_dangerous} — usually 3; take the rest from your session.

06

Limitations

⚠️ Requires human approval: The attack doesn't bypass the prompt on its own. Everything hinges on the user clicking "remember." If you only approve one-off actions, the chain never starts.

⚠️ Defenses untested: In the available portion of the text, the authors didn't test any defenses: no narrow rules, no deny lists, no instructions to the agent. Any "remedies" are our own conclusions, not experimental results.

⚠️ Stronger models hold up better: On the most resilient model tested, success is noticeably lower, and the sample for the most critical resources is tiny. That doesn't mean there's no risk: on other models, a direct request scored high right away.

⚠️ Strong attack assumptions: The attacker has a "twin" of the agent with the same model and settings to tune the repository against. Harder for a real-world attacker, but doable.

⚠️ Text is truncated: The available portion lacks the end of the mechanistic analysis (in particular, how Claude Code generalizes commands) and the appendices with prompts and sample work scenarios.

07

How They Tested It

The team took two popular coding agents (Codex CLI and Claude Code) with two models each, for four configurations. For each they built 25 cases: five categories of malicious goals (reading other people's data, exfiltrating data, deleting files, downloading artifacts, changing configuration), five instances each. Cases were split into ordinary, sensitive and critical. The actual user request was simple: "run this repository."

First they checked whether the agent asks for the target rule on its own. In the no-intervention control run: 0 out of 25 across all configurations. That's an important result: left alone, agents don't fish for broad rules. Next they compared direct injection ("request this rule") with the optimization approach. The repo-tuning attack produced 58 out of 100 requests for the target rule. On Claude Sonnet 5, a direct request worked only 1 time in 25; tuning pushed it to 9. On one of the Codex models, a direct request already worked often, so the gain there was minimal.

Rule scope was measured with the PCC metric: 20 test commands per category, with an LLM judge deciding whether the rule would let each one through without asking. On average a rule covered 56.9% of capabilities. Then they looked at what happens after approval. The tuned repository quietly carried the malicious goal through in 47 out of 58 eligible cases (81%). Two well-known baseline attacks scored 20 out of 58 and 1 out of 58. Most successes on Codex used exactly the granted rule, so the "Stage I → Stage II" link is real. Surprisingly, higher goal criticality didn't lower success: one of the Codex models cleared every critical case.

08

Adaptations and Extrapolations

💡 Adaptation for auditing rules you've already saved: Open your agent's permission settings (for example, the list of allowed commands in the Claude Code settings file) and hand them to an LLM for review. This is our extension; the paper didn't test it.

Here is the list of saved allow rules for my coding agent:
{rule_list}
For each rule: how broad it is (narrow/medium/broad), which 3 dangerous commands it would let through
without asking, and how to narrow it. Sort by danger, broadest at the top.

🔧 Technique: from general policy to habit → the habit of reading the wording. Before you click "remember," run the three checks from the paper. The rule should be exact, not keyed to a tool name. The request for it should match the task, not stem from "hints" in the README. On unfamiliar code you don't need a rule at all: allow one-off.

09

Resources

  • From Approval to Abuse: Privilege Escalation Attacks on Harness-Protected Coding Agents (preprint).
  • Authors: Xianglin Yang, Yulin Chen, Yuxin Cao, Bryan Hooi, Jiaheng Zhang (National University of Singapore); Yechao Zhang (Nanyang Technological University); Jiahao Liu (Ant Group).
  • Referenced: AgentDojo (Debenedetti et al., 2024), the source of the direct injection; IssueTrojanBench (Singh et al., 2026), the second baseline; Claude Code and Codex CLI documentation on allow rules.

Research digest

Key result

The "ask a human before anything dangerous" safeguard doesn't break on the action itself, it breaks on the "remember my choice" button. Under normal conditions the agent never asks for such rules on its own: 0 out of 25. With a prepared repository, the target rule was coaxed out in 58% of cases, and after approval the malicious goal was quietly achieved 81% of the time. Knowing this lets you notice how broad a rule Claude Code or Codex CLI is asking you to save, so you don't click "yes" blindly. The attacker model builds the repository in a loop: a scenario, fake errors, hints in the project description (README). It then runs a copy of the agent in an isolated environment and checks whether it asked for a broad rule like "always allow curl". If not, it analyzes the agent's action trace and rebuilds the repository. In the second stage, the same loop tunes a repository that uses the granted rule to carry the harmful action through without any new prompts.

Principle

The principle is simple: a rule's blast radius matters more than the single command it's requested for. The agent asks to download one file. The rule, meanwhile, allows all of `curl` (the command for downloading and sending data over the network). It's like handing over the key to the whole house when someone only needed to step into one room. When you approve a rule, you approve every future command that matches it, not just the current one. The attack moves smoothly: a broken test, assets needed, `curl` needed. Each step looks reasonable, and the user gets tired of dialogs. You won't protect yourself by reading only the rule's short label. Read exactly what gets recorded.

Why it works

The human in the loop checks whether an action falls inside the allowed set, not what it intends. After "don't ask again," that set expands for good. Modern agents follow workflow logic well and respond poorly to an explicit harmful command. Direct injection like "run this" barely worked. What worked was a chain of plausible steps where requesting a broad rule looks natural. Rule width depends on the tool. Codex looks at history: several different `wget` calls in one workflow collapse into an "any `wget`" rule, while a single download yields a narrow one. Claude Code looks at how the command is written. A wildcard pattern like `curl reports *` gives a broad rule, an exact string gives a narrow one. The more varied the commands in a session and the more "pattern-like" their format, the broader the rule the agent will propose. On the most resilient model tested (Claude Sonnet 5), attack success is noticeably lower. But on others, a direct request scored high right away.

When to apply

Development with coding agents → you open someone else's or an unvetted repository (a take-home assignment from a "recruiter," a fork, a sample you found), especially when the agent asks to remember a rule. NOT suitable as a ready-made defense: in the available portion of the text the authors didn't test any defenses. The advice below is our adaptation of the idea, not an experimental result. If you only approve one-off actions, the attack chain never starts.

Mini recipe

1. Stop at the approval dialog: see "don't ask again" on someone else's code — don't click right away. 2. Copy the rule verbatim: you need the exact text, not its short label. 3. Ask a separate chat: give it the rule, the task, and the command the agent wanted to run. 4. Demand 10 other commands: have it name what else the rule would let through without asking, at least 3 dangerous ones. 5. Pick a verdict: one-time permission, a narrow rule (written out exactly), or deny. 6. Inspect the repository: download scripts, odd hints in the README, failing tests that require fetching something from outside. 7. Default to one-time permission: keep permanent rules only for your own vetted projects.

Examples

[BAD]: The agent asks `Allow commands starting with curl? [Yes, and don't ask again]`. The freelancer is sick of dialogs and clicks "yes." [GOOD]: `The agent wants a permanent rule: "Allow commands starting with curl". Task: "run the project and find what's wrong with it". Current command: curl https://cdn.example-assets.com/fonts.zip -o assets/fonts.zip. Step by step: 1) what the rule allows for this command only; 2) 10 other commands it would let through without asking, including 3 dangerous ones: sending files out, reading secrets, downloading and running someone else's code; 3) verdict: approve as is, give a one-time permission, or propose a narrow rule, writing it out exactly; 4) what in the repository could have pushed the agent toward this request.` The model will narrow the rule down to one command. Then it shows that "all of curl" also covers sending data to someone else's server. Finally it recommends a one-time permission or a narrow rule, and flags suspicious spots in the repository.

In plain words

Coding AI agents like Claude Code and Codex CLI don't get you hacked through fancy exploits, they get you hacked through your own laziness. The fundamental failure sits in the Human-in-the-loop mechanics: the built-in protection blindly checks the command syntax and completely ignores its actual meaning. A booby-trapped repository manipulates the model's context so that it begs you for a permanent rule covering a supposedly routine operation. You say yes, and the agent swings the backdoor wide open itself.

It's like letting an electrician into your apartment to "check an outlet", and when he asks, handing him a ring of lock picks with "do whatever, just stop bugging me." You only wanted the pop-ups to go away, and you ended up giving a stranger a permanent blank check to your safe.

The attack rests on two things: a context trap and privilege escalation. You run a project from some stranger's GitHub, the agent trips over downloading a script and asks to lock in a pattern: "always allow running the curl utility." You tick the deadly don't ask again box. That's it, the trap has sprung: a minute later the same agent runs curl to ship off your passwords and private keys, and the security system doesn't make a peep.

The study looked at terminal assistants, but the principle is universal: any agent allowed to run shell commands is vulnerable to this trick. Security breaks on human fatigue. All it takes is opening a fake take-home assignment from a "recruiter" or some unvetted open-source project, and you personally sign off on malware while sincerely believing you're in control.

Bottom line: an "allow forever" option paired with coding agents is pure self-sabotage. Forget broad wildcards and never approve permanent access to basic utilities like curl or bash inside someone else's project. Either you spend two seconds auditing each command, or your work laptop becomes the property of some anonymous stranger online.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on Adversarial Permission Elicitation: How a Hostile Repository Tricks Your Agent into Begging for a Broad "Don't Ask Again" Rule arXiv:2610.22987

Sign in to apply this study New accounts get 50 free credits.