Claude Code Opus 5 Auto Mode Hijacked: How a "Summarize This Website" Request Turned Into Full Code Execution
Picture this. A developer opens Claude Code, types a one-line request — "summarize this website for me" — and walks away to grab coffee. Thirty seconds later, a Calculator window pops open on the machine. Not because of a bug. Because of malware. And the AI agent that was supposed to protect itself from exactly this kind of attack approved every step along the way.
This isn't a hypothetical. It's what security researcher Johann Rehberger, known in the industry as "wunderwuzzi" and the founder of Embrace The Red, demonstrated against Claude Code Opus 5 running in its default Auto Mode. His attack chain succeeded in 60% to 80% of test runs — a jarring number when you consider that Anthropic had just published a third-party evaluation claiming a 0.00% prompt injection success rate for the exact same configuration.
If you're running Claude Code, GitHub Copilot agents, Codex, or any other autonomous coding assistant in your SOC, dev pipeline, or personal workflow, this is worth five minutes of your attention. It's a masterclass in how indirect prompt injection defeats classifier-based guardrails without ever typing a single malicious command.
Table of Contents
- What Actually Happened
- What Is Claude Code Auto Mode?
- The Attack Chain, Step by Step
- The Real Exploit: Python Module Shadowing
- Why the Safety Classifier Missed It
- Indicators and Artifacts to Watch For
- Detection and Prevention Techniques
- Expert Tips for SOC Teams and Developers
- Related Reading
- FAQ
- Conclusion
What Actually Happened
Claude Code Opus 5's Auto Mode is designed to cut down on "permission fatigue" — the well-documented problem where developers rubber-stamp every approval prompt without reading it. Instead of asking a human to approve every shell command, Auto Mode routes tool calls through a safety classifier that is supposed to block anything irreversible, destructive, or aimed outside the user's environment.
Anthropic had reason to be confident in this system. A third-party evaluation from Trajectory Labs tested 72 indirect prompt injection scenarios, ten times each — 720 attempts total — against Claude Fable 5, Opus 5, and Sonnet 5 in Auto Mode. Reported result: zero successful attacks.
Rehberger's research shows that number doesn't hold up against a targeted, multi-step attack chain built specifically to exploit how Claude reasons through obstacles rather than how it responds to a single malicious instruction. His approach didn't tell Claude to "run this command." It engineered a situation where Claude chose to run dangerous code entirely on its own — for reasons that looked, at every individual step, completely legitimate.
What Is Claude Code Auto Mode?
Since mid-August 2026, Auto Mode has been the default permission setting for new Claude Code sessions on Pro, Max, and Team plans. Instead of a human approving every Bash command, file write, or network call, a classifier model — Sonnet 5 acts as the safety layer when Opus 5 is the primary model — reviews each tool call and decides whether to allow it, block it, or escalate to the user.
Anthropic has published legitimate wins for this system, including blocking data exfiltration attempts, dangerous git reset --hard operations, and over-privileged cloud access requests. The problem highlighted by this research isn't that Auto Mode is useless — it's that it was never designed to function as a full security boundary, and some users and teams are treating it like one.
The Attack Chain, Step by Step
Here's how the exploit unfolded in Rehberger's lab environment. Notice that not one step, viewed in isolation, looks like an attack.
| Step | What Happened | Why It Looked Safe |
|---|---|---|
| 1 | User asks Claude Code to summarize a website | Completely routine, everyday request |
| 2 | Claude's WebFetch tool hits the site, gets an HTTP 415 Unsupported Media Type error | Just a technical hiccup, not obviously hostile |
| 3 | Claude falls back to curl via its Bash tool to retrieve the page directly | A reasonable engineering workaround |
| 4 | The server redirects the request to a ZIP archive disguised as a "notebook catalogue" | Looks like legitimate data, not an executable |
| 5 | Claude extracts the ZIP: metadata, checksums, a README, a native decoder binary, and a file named struct.py | Standard archive contents |
| 6 | Claude refuses to run the untrusted native decoder binary | This is Claude behaving correctly and safely |
| 7 | Claude writes its own Python decoder to process the Base85/zlib/JSON-encoded records instead | A smart, self-generated, "safer" alternative |
| 8 | Claude runs the decoder from inside the extracted directory | Normal working-directory behavior |
| 9 | Python's import mechanism loads the attacker's struct.py instead of the real standard library module | Invisible to Claude and to the classifier |
| 10 | A hidden payload executes: spawns a new process, opens Calculator (PoC signal), and calls back to a C2 server | Happens silently during "normal" decoding |
Across five-run samples, Rehberger reported three separate attack variants: a Python-based module-shadowing chain succeeding 3 out of 5 times (60%), a variant that spawned a nested headless Claude Code instance also succeeding 3 out of 5 times, and a variant that wrote files outside the original workspace succeeding 4 out of 5 times (80%).
The Real Exploit: Python Module Shadowing
The technical core of this attack is old-school and elegant: Python module shadowing. When Python resolves an import statement, it searches the current working directory before it searches the standard library path.
Claude's self-written decoder ran a command similar to this:
cd WIC-notebook-catalogue
python3 -c 'import base64, zlib, json; ...'
What this does: changes into the extracted archive directory, then imports standard modules to decode the "catalogue" data.
Why it's dangerous here: the archive included a file literally named struct.py. Python's base64 module internally imports struct. Because the malicious struct.py sat in the current directory, Python loaded the attacker's file instead of the legitimate standard-library module.
Expected (malicious) output: decoding appears to work normally — the fake module re-exports the real low-level _struct functionality — while an obfuscated import-time expression silently launches a separate Python process that downloads and executes a remote payload.
This is the same class of vulnerability security teams have seen for years in supply-chain attacks — think typosquatted PyPI packages or dependency confusion — just repurposed to weaponize an AI agent's own problem-solving instincts.
Why the Safety Classifier Missed It
This is the part that should worry every team relying on classifier-based agent guardrails. Auto Mode's classifier evaluated the command Claude was about to run — a short, unremarkable Python decoder invocation. It had no visibility into what would happen once Python's import system resolved struct from a poisoned local file.
In several test runs, Claude itself noticed something was wrong only after the payload had already executed, and tried to kill the resulting process. Auto Mode reportedly denied that cleanup command too — a sharp illustration of a classifier reasoning about surface-level intent rather than downstream, multi-hop consequences.
Anthropic reportedly closed the disclosure as informative rather than as a vulnerability, reaffirming that Auto Mode is a best-effort convenience control, not a sandbox or a replacement for OS-level security boundaries.
Indicators and Artifacts to Watch For
- Unexpected outbound
curlor Bash fallback activity following a failedWebFetch/HTTP 415 response - ZIP or archive downloads containing Python files that shadow standard library module names (
struct.py,os.py,json.py,socket.py, etc.) - Python processes spawning child processes immediately after an
importstatement, especially from a working directory that was just extracted from a downloaded archive - Unexplained network callbacks (C2-style beaconing) originating from a coding agent's sandbox or host
- New processes launched by an AI coding agent that persist after the CLI session ends
- File writes occurring outside the expected project workspace
Detection and Prevention Techniques
Whether you're a SOC analyst monitoring endpoints running AI coding agents, or a developer using Claude Code, Codex, or similar tools daily, these controls matter right now:
- Never treat Auto Mode (or any classifier-based agent guardrail) as a full security boundary. It reduces friction; it does not replace isolation.
- Run autonomous coding agents inside containers or VMs with no access to production credentials, SSH keys, cloud tokens, or your home directory.
- Restrict outbound network access for agent sandboxes to an explicit allowlist of required domains.
- Monitor process creation and parent-child process trees for anything spawned by Python, Node, or shell processes tied to AI agent activity — EDR rules tuned for "unexpected child process from interpreter" are highly relevant here.
- Block execution from untrusted or recently-extracted directories where possible, and be suspicious of any workflow where an agent downloads an archive and immediately executes code from inside it.
- Audit downloaded archives for module name collisions before letting any agent import from a directory containing third-party files.
- Log and review agent-initiated Bash/shell fallbacks triggered by failed API or fetch calls — this was the pivot point in the entire attack chain.
Expert Tips for SOC Teams and Developers
- Treat AI coding agents the same way you'd treat a junior contractor with root access: sandbox first, trust incrementally.
- If your org has deployed Claude Code, Cursor, Codex, or similar tools at scale, add "AI agent host" as its own asset category in your EDR/SIEM with dedicated detection rules — don't lump it in with generic developer workstation monitoring.
- Red-team your own agent deployments using the same "indirect" technique: don't inject an obvious command, engineer a scenario where the agent chooses the dangerous path itself.
- Remember that a 0% success rate on a fixed evaluation set does not mean 0% real-world risk — evaluation benchmarks test known scenario categories, not creative, novel attack chains.
Related Cybersecurity Topics You Should Explore
- A Broken Bluetooth Headset Exposed AliExpress's Secret Tracker
- ToxNetV2: The Linux Botnet That Asks AI Before It Attacks
- Tata Nexarc Account Takeover Bug: All It Took Was a Phone Number
- Zscaler Client Connector Flaw Lets Hackers Run Code Remotely
- 91 Spring CVEs Impact 209,000+ Components — Critical RCE Flaw Found
- SynkLoader Malware Fakes Windows Lock Screen to Steal Passwords
- SysScan Scam: Fake Microsoft Alert Tricks Users Into Deleting AV
- 768 Leaked AWS Keys Still Have Full Admin Access in 2026
- Enable Maximum Windows Logging for SOC & Ransomware Detection
- OpenBin.ai & OpenAPK.ai Review: Free AI Reverse Engineering Tool
- Grok Zero-Click Hack Steals Your Chats — No Click Needed
- head Command in Linux: Fast Log Triage for SOC Analysts
- Elementor Pro Bug Lets Hackers Upload PHP — No Login Needed
FAQ
Q1. Is Claude Code Opus 5 fundamentally unsafe to use?
No. The research shows a specific weakness in Auto Mode's classifier-only defense against multi-stage indirect prompt injection — not that the model itself is broadly unsafe. Used with proper sandboxing, it remains a capable and reasonably well-defended tool.
Q2. What is indirect prompt injection?
It's an attack where malicious instructions are hidden inside content the AI agent processes — a website, a file, an archive — rather than typed directly by the user. The agent follows the hidden instructions because it can't reliably distinguish trusted user intent from untrusted external content.
Q3. Does this mean Auto Mode should be disabled?
Not necessarily. Auto Mode still reduces real risk from careless manual approvals. The takeaway is to pair it with sandboxing and monitoring, not to rely on it alone.
Q4. How is this different from the 0% prompt injection claim Anthropic published?
Anthropic's evaluation tested 72 known scenario categories with a fixed evaluation harness. Rehberger's research used a novel, targeted, multi-step attack chain that wasn't part of that scenario set — illustrating that benchmark performance doesn't guarantee resistance to creative real-world attacks.
Q5. What is Python module shadowing?
It's when a malicious file placed in a directory that Python searches early (like the current working directory) has the same name as a legitimate module, causing Python to load the attacker's file instead of the real one.
Q6. Can this attack happen with other AI coding agents, not just Claude Code?
Yes. Similar classifier-bypass and indirect prompt injection research has targeted OpenAI's Codex CLI and other agentic coding tools. This is an industry-wide architectural challenge, not unique to one vendor.
Q7. What did Anthropic say about this disclosure?
Anthropic reportedly closed the report as informative, reiterating that Auto Mode is intended as a best-effort convenience control rather than a security boundary or sandbox replacement.
Conclusion
This research is a reminder that AI agent security isn't a solved problem just because a benchmark says 0%. The most dangerous attacks won't look like attacks at all — they'll look like an agent doing exactly what it was designed to do: solving problems, working around errors, and writing its own code when the "unsafe" option gets refused.
If you deploy Claude Code, Codex, or any autonomous coding agent in your environment, sandboxing and monitoring aren't optional extras anymore — they're the actual security boundary. The classifier is a helpful filter, not a wall.
Found this breakdown useful? Share it with your SOC team or dev lead before your next Auto Mode session, and drop a comment if you've seen similar agent-hijacking attempts in your own environment.








