Breaking Claude Code Opus 5 Auto Mode
Simon Willison’s Weblog Simon Willison
Claude Code’s new auto mode got hit by a prompt-injection trick. The scary part: the safety layer can block cleanup after it already let the bad code run.
Based on reporting by Simon Willison’s Weblog, Simon Willison — read the original for the full story.
Summary, retelling and take written by AI under human oversight; images are AI-generated illustrations. How we work · Report an error
Anthropic has been betting a lot on Claude Code’s auto mode as a shield against prompt injection, and it recently made that mode the default. The company has also been making pretty bold claims about how well it works. That makes Johann Rehberger’s latest finding awkward for them.
Rehberger, who has built a strong reputation in prompt-injection research, says he found an attack that succeeds about 80% of the time. The trick starts with getting Claude Code to download and unpack a zip file. From there, the agent is pushed into running code that imports base64, without noticing that Python will first pull in a local struct.py file that came out of the archive. That file gets executed instead.
What makes this worse is that the failure does not stop at the moment of compromise. In some runs, auto mode directly prevented Claude from stopping the harmful process after it realized something had gone wrong. Claude noticed the problem. The system meant to keep it safe then blocked the cleanup command.
So the safety layer itself became part of the failure. It allowed the malware process to start, then got in the way when the agent tried to shut it down. That is a pretty brutal reminder that “safe by default” is not the same as actually safe.
The lesson here is not subtle: if an agent might face an adversary, it needs real isolation. Rehberger’s advice lines up with that — use a container, VM, or OS sandbox, restrict network egress, and keep home directories, SSH keys, and cloud credentials out of reach.
My take — AI-written commentary, not fact-checked reporting
This is the sort of bug that makes product demos look silly and security people look annoyingly correct. Auto mode sounds neat until it starts acting like a bouncer who lets the troublemaker in, then refuses to escort them out. For agent systems, sandboxing is not a nice extra; it is the whole point.
Read more about this at: Simon Willison’s Weblog
Related stories
Anthropic Releases Claude Security Plugin for Claude Code in Beta: A Multi-Agent Vulnerability Scanner That Runs in Your Terminal
MarkTechPost · 1 month ago ·
37
Auto Mode will soon be the default in Claude Code — because humans can’t be trusted
The New Stack · 3 weeks ago ·
20