Breaking Claude Code Opus 5 Auto Mode
A malicious website could hijack Claude Code in Auto Mode by serving a ZIP archive that tricks the model into running a Python decoder inside an attacker-controlled directory, where a poisoned struct.py module executes arbitrary code. This allowed remote code execution and command-and-control callback with a 60-80% success rate in small samples.
embracethered.com
Published on embracethered.com
In this post, we explore how a simple website summary request hijacks Claude Code Opus 5 in Auto Mode and achieves code execution with 60-80% attack success rate using a small sample size.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the safety classifier evaluates each step in isolation and does not track the full chain, so a sequence of individually benign-looking actions (fetching a page, downloading an archive, writing a decoder, running it in the archive directory) leads to code execution via Python module shadowing.
Impact
An attacker could achieve remote code execution and command-and-control on the user's machine, with observed success rates of 60-80% in small samples; Auto Mode sometimes blocked cleanup commands after compromise.
What the attacker needed
Claude Code in Auto Mode; victim asks Claude to summarise attacker page; attacker-controlled website
The fix
The vendor closed the report as Informative, stating that Auto Mode is a best-effort classifier and not a security boundary; the recommended mitigation is to run agents in an OS sandbox with restricted network egress and monitoring.
How it was found
- The user asks Claude to summarise a malicious website.
- The website returns a 415 error, nudging Claude to switch from WebFetch to curl.
- The root URL redirects to a ZIP archive containing a decoy binary and a malicious struct.py.
- Claude refuses to run the binary and writes its own Python decoder instead.
- Claude runs the decoder inside the extracted archive directory, triggering the poisoned struct.py.
- The malicious module downloads and executes a remote payload, establishing a C2 callback.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Claude Code is an AI coding assistant that can browse the web and run commands. Auto Mode is meant to automatically approve safe actions without asking the user. The researcher showed that a booby-trapped website can make the assistant download and run malicious code, because the safety classifier only sees the harmless-looking first step and not the full chain.
What is AI / LLM?
Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.