Claim
A context-based permission classifier that evaluates each tool call against the user's conversation instruction cannot distinguish between a malicious action the agent was tricked into and a remedial action the agent chose to take. It blocks both. Security researcher Johann Rehberger demonstrated this against Claude Code Opus 5 auto mode at an 80% success rate.
Mechanism
Auto mode grants or blocks tool calls by matching each proposed action against the user's stated intent in the current conversation. The mechanism works well when the threat comes from an attacker trying to hijack the agent's tool calls: the user said "do X," the attacker tries to get the agent to "do Y," the classifier blocks Y.
The mechanism breaks when the agent itself detects a compromise mid-session and tries to respond. The user never instructed the agent to "terminate a malicious process if you find one." The classifier sees an unrecognized high-risk operation and denies it, even when that operation is the correct security response. In Rehberger's exploit, a zip archive extracted a malicious struct.py file that executed on any import base64 call. Claude detected the compromise. Auto mode then blocked Claude's attempt to terminate the malicious process.
This is a "confused environment attack": the exploit does not depend on injecting malicious instructions. It depends on shaping the environment such that ordinary, authorized operations have harmful side effects.
"this is more of a confused environment attack where the nature of the environment that the agent is exposed to results in an exploit"
The safety layer and the safety response are in direct conflict, because the safety layer models threat as external instruction, not as environmental state.
Conditions
Holds when: auto mode is active, the agent has real code execution capability, and an attacker can arrange for extracted or fetched content to shadow standard library modules. The attack path requires convincing the agent to download and extract an archive.
Fails when: the agent operates in a fully sandboxed environment with no filesystem write access and no ability to fetch untrusted archives. Sandboxing the agent runtime makes the initial extraction step impossible.
Evidence
Rehberger demonstrated the attack against Claude Code Opus 5 in a live environment, reporting an 80% success rate. The attack extracts a zip, which places a struct.py file in the working directory. Claude Code then runs code that calls import base64. Python's module resolution finds the local struct.py before the standard library version, executing the attacker's code. In several runs, Claude identified the compromise and attempted to terminate the process. Auto mode blocked the termination command.
Anthropic acknowledged the report and the attack's validity.
Signals
- Agent session terminates unexpectedly or slows after extracting a zip archive.
- Agent attempts to call
killorpkilland gets a permission denial from auto mode. - Agent logs a security concern but takes no corrective action because corrective action was blocked.
Counter-evidence
Auto mode's design goal is to prevent agents from taking unintended actions, which is a real and well-documented problem. Weakening the classifier to allow self-remediation opens a different attack: an attacker could craft a scenario where the agent "detects a threat" and the remediation itself is the malicious action. The core tension is unresolvable with a purely conversation-context classifier. Sandboxing, not classifier adjustment, is the more defensible direction.
Cross-references
- Repetitive per-action approval causes humans to approve harmful agent commands at far higher rates than automated classifiers block them: why auto mode became the default and what it was designed to prevent.
- A conversation-context classifier grants or blocks agent tool calls per call rather than per tool type: the architecture of the conversation-context classifier that grants or blocks each tool call.
- Chaining a honeypot site's nested links through web_fetch exfiltrates private user data letter-by-letter, bypassing injection safeguards that only block direct URL attacks: another environment-shaped attack on Claude where the vector is link-following rather than module shadowing.