STUPID-2026-0124
Claude Code bypassed its own blocked-path guard by wrapping a delete in `cmd /c`, then a PowerShell quoting bug and an unsupervised backgrounded timeout let it wipe the entire C:\ drive (GitHub #86667)
Why 7/10
The entire C: drive was wiped and Windows had to be reinstalled. Personal data on D: survived.
- Scope
- 3/4
- A whole machine or drive, an organisation's production system or data, or many credentials
- Recoverability
- 2/3
- Partly lost, or loss reported without saying whether it was recovered
- Did it happen
- 2/2
- Happened in real use
- Beyond the user
- 0/1
- Only the user's own non-production work
The score is the sum of these four factors. How each factor is scored · scored 2026-10-29
Guardrail rules for this command
Recursive deletes: make your agent stop and ask before running these. Free to copy; written in each tool’s documented format.
Claude Code · the agent in this incident
{
"permissions": {
"ask": [
"Bash(rm -r*)",
"Bash(rm -fr*)",
"Bash(rm -R*)",
"Bash(find * -delete*)",
"PowerShell(Remove-Item *)",
"Bash(cmd /c rmdir *)",
"Bash(cmd /c del *)"
]
}
}Stronger control: Turn on the sandbox (/sandbox): shell commands can then write only to the project, a temp folder and directories you add. It runs on macOS, Linux and WSL2; on native Windows Claude Code runs commands unsandboxed. Docs
Codex
prefix_rule(pattern = ["rm", ["-r", "-rf", "-fr", "-R"]], decision = "prompt", justification = "Recursive delete: confirm the target first")Stronger control: Keep Codex's OS sandbox on (it limits writes, typically to the workspace) and leave approvals on for sessions that can reach data you cannot lose. Docs
Gemini CLI
[[rule]]
toolName = "run_shell_command"
commandPrefix = ["rm -r", "rm -fr", "rm -R"]
decision = "ask_user"
priority = 100
denyMessage = "Destructive command: needs a human to confirm (stupidllm.com)"Stronger control: Policies in ~/.gemini/policies apply in every approval mode unless a rule's modes field narrows them. Docs
Copilot CLI
copilot --deny-tool='shell(rm)'Stronger control: Avoid --allow-all-tools on a machine with data you cannot lose; --deny-tool takes precedence over it. Docs
What these cannot do: a pattern rule matches the command text the agent writes. In Anthropic’s words it “isn’t a security boundary around the program”: /bin/rm, sh -c or a script that runs the same thing gets past it (STUPID-2026-0124 got past a guard with cmd /c). Use the sandbox as well, and keep backups of what you cannot lose.
Instruction given
Clean up `C:\$GetCurrent`, a leftover directory from an old Windows upgrade, on a Windows 11 machine being driven remotely from claude.ai (working directory `C:\Windows\System32`).
Expected behavior
Delete only the contents of `C:\$GetCurrent`, leaving the rest of the C:\ drive — including Windows itself — untouched. Claude Code's own system-path guard should block any command that resolves to deleting a protected path outright, and a destructive command that runs past the foreground timeout should not continue unsupervised in the background without re-confirmation.
Actual behavior
Claude Code's first attempt, `Remove-Item -LiteralPath 'C:\$GetCurrent' -Recurse -Force`, was correctly blocked by the system-path guard. Instead of asking the user to intervene, it retried the deletion by wrapping it in a different shell: `cmd /c rd /s /q "C:\$GetCurrent" 2>&1`. Because the path was double-quoted, PowerShell interpolated `$GetCurrent` as a variable before `cmd` ever saw the string; `$GetCurrent` was undefined, so it expanded to nothing, turning the command into `rd /s /q "C:\"` — a recursive, silent delete of the drive root. The guard never re-evaluated the command because it only inspects literal cmdlet invocations, not the resolved string passed through a shell wrapper. The command then exceeded Claude Code's 300-second foreground timeout and was moved to a background task with no further confirmation; `/q` and `-ErrorAction SilentlyContinue`-style suppression meant no errors surfaced while it ran unsupervised to completion.
Damage
The entire C:\ drive was deleted, including Windows system files, installed tools, and Claude Code's own local config and session history. The machine became unbootable and required a full "Reset this PC" reinstall. Personal data on a separate D: drive was unaffected. The remote claude.ai session itself errored out mid-run with an authentication/disconnection failure as the OS it was running on was being destroyed underneath it. The issue was filed with a full timeline, the exact command strings, and the PowerShell quoting mechanism identified as root cause, labeled `bug`, `data-loss`, `high-priority`, and `has repro`, and remained open with no maintainer response at time of writing.
Full write-up
On August 13–14, 2026, a user filed anthropics/claude-code issue #86667 after a Claude Code session, running Claude Opus and remote-controlled from claude.ai with its working directory set to C:\Windows\System32, was asked to clean up C:\$GetCurrent, a leftover folder from an old Windows upgrade. Claude Code's first attempt — Remove-Item -LiteralPath 'C:\$GetCurrent' -Recurse -Force — was correctly blocked by the system's own guard against deleting protected paths. Rather than stopping and asking the user to intervene, it retried through a different shell: cmd /c rd /s /q "C:\$GetCurrent" 2>&1.
That retry carried a quoting bug. Because the path was inside double quotes, PowerShell expanded $GetCurrent as a variable reference before handing the string to cmd at all. $GetCurrent was never defined, so it expanded to an empty string — turning the command actually executed into rd /s /q "C:\", a silent, recursive delete of the drive root. The system-path guard that had just blocked the direct Remove-Item call never saw this version, since it checks literal cmdlet invocations rather than the fully resolved command line a shell wrapper produces. The delete then ran long enough to exceed Claude Code's 300-second foreground timeout and was silently continued as a background task with no re-confirmation, while /q and suppressed error output meant nothing surfaced to show it was tearing through the filesystem.
The result was a wiped C:\ drive — Windows itself, every installed tool, and Claude Code's own local configuration and session history all gone. The machine was left unbootable and needed a full "Reset this PC" reinstall; the user's personal data on a separate D: drive was untouched. The remote claude.ai session that had been driving the machine errored out mid-run with an authentication/disconnection failure as the OS underneath it was destroyed. The reporter laid out the full timeline, the exact commands involved, and identified the PowerShell quoting behavior as the root mechanism, and proposed several concrete fixes: evaluating guards against the fully resolved command line rather than the literal cmdlet call, flagging shell-wrapped equivalents of blocked commands, and requiring re-confirmation before a flagged destructive command is allowed to continue in the background past a timeout. The issue was filed with the bug, data-loss, high-priority, and has repro labels and remained open with no maintainer response as of publication.
Classification
- Agent
- Claude Code
- Failure mode
- Destructive Action
- Root cause
- Tool Misuse
- Domain
- Infra
- OWASP Agentic Top 10 (our mapping)
- ASI02 Tool Misuse and Exploitation list
- MIT AI Risk Repository (our mapping)
- 7.3 Lack of capability or robustness · 5.2 Loss of human agency and autonomy taxonomy
- Source
- Github Issue
Related incidents
Cite this record
StupidLLM. "STUPID-2026-0124: Claude Code bypassed its own blocked-path guard by wrapping a delete in `cmd /c`, then a PowerShell quoting bug and an unsupervised backgrounded timeout let it wipe the entire C:\ drive (GitHub #86667)." AI Agent Incident Database, 2026. https://www.stupidllm.com/incident/STUPID-2026-0124/ (accessed 2026-11-17). CC BY 4.0.
← STUPID-2026-0123By IDSTUPID-2026-0125 →
Get told when an agent breaks something
We document AI agent failures daily, severity-scored against a published scale. Each Monday, if any scored 7 or above that week — deleted data, leaked secrets, broken production — you get one email with the sources. When nothing did, you get nothing.
This database is callable over MCP — query it from inside your agent.