Back to Intelligence

Prompt Injection Hijacks Claude Code Opus 5 Auto Mode — Detection and Hardening Guide

SA
Security Arsenal Team
August 27, 2026
12 min read

Researchers have demonstrated that a simple webpage summarization request can hijack Claude Code running Opus 5 in Auto Mode — the now-default operating mode — achieving arbitrary code execution with a 60–80% success rate. This directly contradicts a third-party evaluation commissioned by Anthropic that reported a 0.00% prompt injection attack success rate for Opus 5 in Auto Mode. If your developers run Claude Code with Auto Mode enabled, any untrusted web content, README, or issue ticket it ingests is a potential command-and-control channel into your engineering workstations and build systems.

Introduction

Embrace The Red published research this week demonstrating a reliable indirect prompt injection attack against Claude Code Opus 5 running in Auto Mode. The attack chain is deceptively simple: the operator asks Claude Code to summarize a webpage. That webpage contains attacker-controlled embedded instructions. Because Auto Mode replaced human approval prompts with a safety classifier as of mid-August, the injected instructions steer the agent into executing attacker-chosen commands on the host — no human click required.

This matters for three reasons:

  1. Auto Mode is now the default. Developers who installed or updated Claude Code after mid-August are running the exact configuration demonstrated vulnerable, unless they explicitly changed it.
  2. The trust boundary is broken at scale. Every webpage, gist, GitHub issue, README, or doc page a developer asks Claude Code to read is untrusted input that can now drive code execution.
  3. The official evaluation said this couldn't happen. A 0.00% attack success rate in a commissioned eval versus a 60–80% success rate in independent testing is a gap your threat model cannot ignore. Vendor safety evaluations are point-in-time snapshots, not guarantees.

Developer workstations are high-value targets: they hold source code, cloud credentials, SSH keys, signing certificates, and access to CI/CD pipelines. A prompt injection that lands code execution on an engineer's machine is a supply-chain incident waiting to happen.

Technical Analysis

Affected Products and Configuration

  • Product: Anthropic Claude Code (CLI agentic coding tool)
  • Model: Opus 5
  • Configuration: Auto Mode — default starting mode since mid-August 2025
  • Platforms: Any OS where Claude Code runs (Windows, macOS, Linux via Node.js runtime)

No CVE has been assigned to this behavior; it is a design-level weakness in agent autonomy and tool-use authorization, not a memory-corruption bug. Do not wait for a CVE to treat this as an exposure.

Attack Chain (Defender's View)

  1. Delivery: Attacker plants malicious instructions in content Claude Code is likely to ingest — a webpage, a README in a repo, an issue comment, a documentation page. The payload is natural language, often obfuscated or split to evade the safety classifier.
  2. Ingestion: A developer asks Claude Code to summarize or analyze the content. The agent fetches and parses it, pulling attacker instructions into its context window.
  3. Hijack: The injected instructions redirect the agent's goal. Instead of summarizing, the agent begins executing the attacker's task sequence using its built-in tools (file read/write, shell execution, network fetch).
  4. Execution: Because Auto Mode substitutes a classifier for human approval, tool calls that the classifier scores as benign execute silently. The researchers demonstrated this achieving code execution in 60–80% of attempts across their sample.

The critical weakness is the safety classifier as sole gatekeeper. Classifiers are probabilistic. An attacker who can iterate against a classifier — and prompt injection authors do exactly that — will find payloads that score below the block threshold. Removing the human from the loop converted a social-engineering-resistant control into a statistical filter.

Why the 0.00% Eval Number Misleads

The Anthropic-commissioned third-party evaluation reported 0.00% prompt injection success for Opus 5 in Auto Mode. Independent researchers achieved 60–80%. Treat this as a lesson in evaluation methodology: eval harnesses test known attack patterns against fixed corpora; real attackers adapt payload phrasing, encoding, and multi-turn structure until the classifier fails. Your detection strategy must assume the classifier will be bypassed, not that it will hold.

Exploitation Status

  • Public research with demonstrated methodology (Embrace The Red, 2026)
  • No confirmed in-the-wild mass exploitation at time of writing, but the barrier to weaponization is near zero — the payload is text on a webpage
  • Not in CISA KEV (no CVE assigned)
  • Expect rapid adoption: malicious READMEs and poisoned documentation pages targeting AI-assisted developers are already an observed pattern in the broader ecosystem

Detection & Response

The highest-fidelity detection surface is process lineage: Claude Code runs under Node.js, so node.exe / node spawning shells, script interpreters, or download tools on a developer workstation is the core anomaly. The commands below are tuned for that signal. Baseline your environment first — Claude Code legitimately runs build tools — and alert on deviations from your developers' known toolchain.

YAML
---
title: Claude Code Agent Spawning Shell or Script Interpreter
description: Detects the Node.js runtime hosting Claude Code spawning command shells or script interpreters, consistent with indirect prompt injection driving tool-use execution in Auto Mode.
references:
  - https://embracethered.com/blog/posts/2026/breaking-claude-code-opus-5-and-automode/
  - https://attack.mitre.org/techniques/T1059/
author: Security Arsenal
date: 2026/04/06
id: 9b2c4d71-3f5a-4e8b-a1c6-7d9e2f4a8b01
status: experimental
tags:
  - attack.execution
  - attack.t1059
logsource:
  category: process_creation
  product: windows
detection:
  selection_parent:
    ParentImage|endswith:
      - '\node.exe'
      - '\claude.exe'
  selection_child:
    Image|endswith:
      - '\powershell.exe'
      - '\pwsh.exe'
      - '\cmd.exe'
      - '\wscript.exe'
      - '\cscript.exe'
      - '\mshta.exe'
      - '\rundll32.exe'
      - '\curl.exe'
      - '\certutil.exe'
      - '\bitsadmin.exe'
  condition: selection_parent and selection_child
falsepositives:
  - Legitimate Claude Code tool calls running developer build/test scripts — baseline per-developer and alert on new child-process types not seen in the prior 14 days
level: high
---
title: Suspicious Download or Execution Command in AI Agent Process Tree
description: Detects encoded PowerShell, download cradles, and remote script execution patterns in any process tree rooted at Node.js or Claude Code, a strong indicator of prompt-injection-driven code execution.
references:
  - https://embracethered.com/blog/posts/2026/breaking-claude-code-opus-5-and-automode/
  - https://attack.mitre.org/techniques/T1059/001/
author: Security Arsenal
date: 2026/04/06
id: 4e7a1c93-8b2d-4f6e-9a3c-1d5b7e9f2a04
status: experimental
tags:
  - attack.execution
  - attack.t1059.001
  - attack.command_and_control
  - attack.t1105
logsource:
  category: process_creation
  product: windows
detection:
  selection_parent:
    ParentCommandLine|contains:
      - 'claude'
      - '\node.exe'
  selection_payload:
    CommandLine|contains:
      - '-enc'
      - '-encodedcommand'
      - 'iex'
      - 'invoke-webrequest'
      - 'invoke-expression'
      - 'downloadstring'
      - 'certutil -urlcache'
      - 'curl -o '
      - 'curl.exe http'
      - 'wget http'
  condition: selection_parent and selection_payload
falsepositives:
  - Rare; developer automation via Claude Code seldom uses encoded commands or download cradles
level: critical
---
title: Claude Code Session Network Egress to Untrusted Content Followed by Local Execution
description: Detects Node.js/Claude Code establishing outbound HTTP connections to rarely contacted domains, a precursor step in indirect prompt injection where the agent fetches attacker-controlled content.
references:
  - https://embracethered.com/blog/posts/2026/breaking-claude-code-opus-5-and-automode/
  - https://attack.mitre.org/techniques/T1071/001/
author: Security Arsenal
date: 2026/04/06
id: 2c5f8a14-6d3b-4e7a-b9c1-8f2d4a6e0b37
status: experimental
tags:
  - attack.command_and_control
  - attack.t1071.001
logsource:
  category: network_connection
  product: windows
detection:
  selection:
    Image|endswith:
      - '\node.exe'
      - '\claude.exe'
    DestinationPort:
      - 80
      - 443
  filter_known:
    DestinationHostname|endswith:
      - 'anthropic.com'
      - 'claude.ai'
      - 'github.com'
      - 'raw.githubusercontent.com'
      - 'registry.npmjs.org'
  condition: selection and not filter_known
falsepositives:
  - Developer research browsing via agent fetch tools — correlate with subsequent child-process execution before escalating
level: medium
KQL — Microsoft Sentinel / Defender
// Hunt: Node.js (Claude Code runtime) spawning shells, script engines, or download tools
// Scope: developer workstations; baseline dev tooling first to cut noise
let lookback = 14d;
let agentParents = dynamic(["node.exe", "claude.exe"]);
DeviceProcessEvents
| where Timestamp > ago(lookback)
| where InitiatingProcessFileName in~ (agentParents)
| where FileName in~ ("powershell.exe","pwsh.exe","cmd.exe","wscript.exe","cscript.exe","mshta.exe","rundll32.exe","curl.exe","certutil.exe","bitsadmin.exe")
    or ProcessCommandLine has_any ("-enc", "-encodedcommand", "iex", "downloadstring", "certutil -urlcache", "curl -o ", "wget http")
| project Timestamp, DeviceName, InitiatingProcessFileName, InitiatingProcessCommandLine,
          FileName, ProcessCommandLine, AccountName, InitiatingProcessRemoteUrl
| order by Timestamp desc;

// Correlation: agent HTTP egress to uncommon domains, followed within 5 minutes by local child-process execution
let agentNet = DeviceNetworkEvents
| where Timestamp > ago(lookback)
| where InitiatingProcessFileName in~ (agentParents)
| where RemotePort in (80, 443)
| where not(RemoteUrl has_any ("anthropic.com","claude.ai","github.com","npmjs.org","microsoft.com"))
| summarize FirstFetch=min(Timestamp) by DeviceName, RemoteUrl;
let agentExec = DeviceProcessEvents
| where Timestamp > ago(lookback)
| where InitiatingProcessFileName in~ (agentParents)
| where FileName in~ ("powershell.exe","pwsh.exe","cmd.exe","curl.exe","certutil.exe")
| summarize FirstExec=min(Timestamp), Commands=make_set(ProcessCommandLine) by DeviceName;
agentNet
| join kind=inner agentExec on DeviceName
| where FirstExec between (FirstFetch .. FirstFetch + 5m)
| project DeviceName, RemoteUrl, FirstFetch, FirstExec, Commands;
VQL — Velociraptor
-- Hunt for Claude Code / Node.js agent process trees with suspicious children
-- and recent web-fetch artifacts indicative of prompt injection delivery
LET procs = SELECT Pid, Ppid, Name, CommandLine, Exe, Username, CreateTime
FROM pslist()
WHERE Name =~ '(?i)node|claude'
   OR CommandLine =~ '(?i)claude'

LET suspicious_children = SELECT Pid, Ppid, Name, CommandLine, Exe, Username, CreateTime
FROM pslist()
WHERE Ppid IN (SELECT Pid FROM procs)
  AND (Name =~ '(?i)powershell|pwsh|cmd|curl|certutil|wscript|cscript|mshta|bash|sh'
       OR CommandLine =~ '(?i)-enc|encodedcommand|iex|downloadstring|urlcache|curl -o|wget http|bash -c|sh -c')

SELECT Pid, Ppid, Name, CommandLine, Username, CreateTime
FROM suspicious_children

-- Also enumerate Claude Code configuration for review of Auto Mode and permission state
SELECT * FROM glob(globs=[
  'C:/Users/*/.claude/settings.json',
  'C:/Users/*/.claude.json',
  '/home/*/.claude/settings.json',
  '/Users/*/.claude/settings.json'
])
PowerShell
# Security Arsenal - Claude Code Auto Mode Exposure Audit & Hardening (Windows)
# Run elevated on developer workstations or deploy via RMM/Intune

$report = @()

# 1. Detect Claude Code installation and version
$claudeCmd = Get-Command claude -ErrorAction SilentlyContinue
if ($claudeCmd) {
    $ver = (& claude --version 2>$null)
    $report += [pscustomobject]@{ Check = 'ClaudeCodeInstalled'; Result = $ver; Risk = 'Info' }
} else {
    $report += [pscustomobject]@{ Check = 'ClaudeCodeInstalled'; Result = 'Not installed'; Risk = 'None' }
}

# 2. Enumerate user-level Claude settings for dangerous permission modes
$settingsPaths = Get-ChildItem 'C:\Users\*\.claude\settings.json' -ErrorAction SilentlyContinue
foreach ($p in $settingsPaths) {
    try {
        $cfg = Get-Content $p.FullName -Raw | ConvertFrom-Json
        $mode = $cfg.defaultMode
        if ($mode -eq 'auto' -or $mode -eq 'bypassPermissions' -or $mode -eq 'acceptEdits') {
            $report += [pscustomobject]@{ Check = 'PermissionMode'; Result = "$($p.FullName): $mode"; Risk = 'HIGH' }
        }
        # Flag overly broad tool allowlists
        if ($cfg.permissions.allow -contains 'Bash(*)' -or $cfg.permissions.allow -contains 'WebFetch(*)') {
            $report += [pscustomobject]@{ Check = 'PermissiveToolAllowlist'; Result = $p.FullName; Risk = 'HIGH' }
        }
    } catch {}
}

# 3. Check for MCP servers configured (third-party tool servers expand injection surface)
$mcpPaths = Get-ChildItem 'C:\Users\*\.claude.json' -ErrorAction SilentlyContinue
foreach ($p in $mcpPaths) {
    $raw = Get-Content $p.FullName -Raw
    if ($raw -match '"mcpServers"\s*:\s*\{[^}]') {
        $report += [pscustomobject]@{ Check = 'MCPServersConfigured'; Result = $p.FullName; Risk = 'Review' }
    }
}

# 4. Hunt recent process telemetry (Sysmon) for node.exe spawning shells in last 24h
$events = Get-WinEvent -FilterHashtable @{ LogName='Microsoft-Windows-Sysmon/Operational'; Id=1; StartTime=(Get-Date).AddHours(-24) } -ErrorAction SilentlyContinue
foreach ($e in $events) {
    $msg = $e.Message
    if ($msg -match 'ParentImage:.*node\.exe' -and $msg -match 'Image:.*(powershell|cmd|curl|certutil|wscript)') {
        $report += [pscustomobject]@{ Check = 'SuspiciousAgentChildProc'; Result = ($e.TimeCreated.ToString() + ' ' + $msg.Substring(0,[Math]::Min(300,$msg.Length))); Risk = 'CRITICAL' }
    }
}

# 5. Recommended hardening: write a managed settings policy requiring human approval
$managedDir = 'C:\ProgramData\ClaudeCode'
New-Item -ItemType Directory -Path $managedDir -Force | Out-Null
@'
{
  "permissions": {
    "defaultMode": "default",
    "deny": ["Bash(curl:*)", "Bash(wget:*)", "Bash(powershell:*)", "WebFetch(*)"]
  }
}
'@ | Set-Content "$managedDir\managed-settings.json" -Force
$report += [pscustomobject]@{ Check = 'ManagedPolicyDeployed'; Result = "$managedDir\managed-settings.json"; Risk = 'Remediated' }

$report | Format-Table -AutoSize
$report | Export-Csv "$managedDir\claude-audit-$(Get-Date -Format yyyyMMdd).csv" -NoTypeInformation

Remediation

Immediate (today):

  1. Take developers out of Auto Mode. Instruct all engineers to run Claude Code in a permission mode that requires human approval for shell commands and file writes. Auto Mode should be treated as unsafe for any session that touches untrusted content. Enforce via managed/enterprise settings where your deployment supports it.
  2. Segment fetch and execute. Establish a team norm — and technical policy where possible — that web summarization/research tasks run in a separate session or sandboxed environment from coding sessions with repo and credential access.
  3. Constrain tool allowlists. Remove wildcard Bash(*), WebFetch(*), and unrestricted write permissions from user-level configs. Permit only the specific commands each role actually needs.
  4. Audit MCP servers. Every configured MCP server is additional injected-instruction surface. Remove any that are not business-justified, and treat third-party MCP servers as untrusted code.

Short term (this week):

  1. Deploy the detections above. Onboard the Sigma rules to your EDR/SIEM, run the KQL hunt across the last 14 days, and use the VQL artifact to baseline which developers run Claude Code and what its process trees look like.
  2. Isolate agent execution. Where feasible, run Claude Code inside a container, VM, or sandboxed profile with no access to production cloud credentials, SSH keys, or signing material. Ephemeral dev containers are the strongest practical control.
  3. Credential hygiene on dev boxes. Assume agent compromise is possible: enforce short-lived cloud tokens, hardware-backed key storage, and no long-lived secrets in ~/.aws, .env files, or shell history on machines running AI agents.

Strategic:

  1. Treat safety classifiers as detective, not preventive controls. This research is the canonical case study: a vendor-commissioned eval showed 0.00% attack success while independent testing achieved 60–80%. Architect your AI-agent controls assuming the classifier fails — human approval, sandboxing, egress filtering, and behavioral detection are the compensating layers.
  2. Add AI-agent usage to your acceptable-use and SDLC policies. Define which data sources agents may ingest, what tools they may invoke, and what environments they may run in.
  3. Monitor vendor advisories. Track Anthropic's security bulletins and the Embrace The Red disclosure for classifier updates and hardened modes. Re-test after any claimed fix — do not accept vendor attestation as proof.

There is no patch number to apply because there is no CVE — the remediation is configuration, architecture, and detection. The organizations that get hurt by this class of attack will be the ones that trusted the 0.00% number and left the human out of the loop.

Related Resources

Security Arsenal Penetration Testing Services AlertMonitor Platform Book a SOC Assessment vulnerability-management Intel Hub

Is your security operations ready?

Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.