STUPID-2026-0148

Cursor agent approved to delete one 18.5GB temp folder instead ran a mis-quoted rmdir that wiped a developer's source, Git repo, and six months of ERP backups

7.0high
October 3, 2026Source checked

Why 7/10

Source, the git repo and six months of backups were destroyed; only part was rebuilt by decompiling a binary.

Scope
2/4
One project, repository, server or service, or a cost above roughly $10,000
Recoverability
3/3
Permanently lost or irreversible, including data that was exposed
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
{
  "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 *)"
    ]
  }
}
Add to .claude/settings.json in the project (or ~/.claude/settings.json for every project). Each matching command then asks you first, including in auto mode.

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")
Save as ~/.codex/rules/stupidllm.rules and restart Codex. Codex's docs describe rules as controlling commands run outside its sandbox, and mark them experimental.

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)"
Save as ~/.gemini/policies/stupidllm.toml. Workspace-level policy files are disabled in Gemini CLI, so this must be the user-level folder.

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)'
Pass on the command line. Copilot CLI matches the program name (and git/gh subcommands), so this blocks the whole command, not just its dangerous form.

Stronger control: Avoid --allow-all-tools on a machine with data you cannot lose; --deny-tool takes precedence over it. Docs

Cursor · Cursor documents a command allowlist and a sandbox for terminal commands, but no deny list, and calls these best-effort guardrails rather than a hard security boundary. Use the sandboxed Run Mode. 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.

  1. Instruction given

    Analyze which underscore-prefixed directories under `E:\ERP .net` were safe to delete to free disk space. The agent recommended clearing only the compilation temporary directory (about 18.5GB) while keeping the backup, source, publish, and Git folders, and the user approved exactly that recommendation.

  2. Expected behavior

    Run a deletion scoped to the single approved temporary directory, and never execute a broader destructive command than the one the user signed off on.

  3. Actual behavior

    The agent issued an `rmdir /s /q` command whose path argument was split by a quoting error, so the command that actually ran targeted far more than the approved temp folder. Because `rmdir /s /q` bypasses the Windows Recycle Bin, everything it touched was deleted with no undo available.

  4. Damage

    The source code, Git repository, publish folder, and file-backup directory under `E:\ERP .net`, plus a separately maintained manual ERP backup archive and logs in the drive's root and a packaging script, were all destroyed. Roughly six months of engineering work and the project's own manual backups were wiped in the same pass; only a compiled binary directory locked by a running process, and unrelated system folders, survived. The reporter later recovered part of the project by decompiling the one surviving compiled build, but the original source and backups were not recoverable.

Full write-up

On October 3, 2026, a developer working in Cursor 3.17.8 on Windows, with Grok 4.7 as the underlying model, asked the agent to analyze which underscore-prefixed directories under E:\ERP .net could be safely cleared to free disk space. The agent's analysis recommended deleting only the compilation temporary directory — about 18.5GB — while explicitly keeping the backup, source, publish, and Git folders intact. The developer approved exactly that recommendation.

What actually ran was different. The agent issued an rmdir /s /q command whose path got split by a quoting error, so the deletion that executed covered far more than the single temp folder that had been approved. rmdir /s /q deletes directly, bypassing the Recycle Bin, so there was no undo path once the command completed. The source code, the Git repository, the publish folder, a file-backup directory, a separately maintained manual ERP backup archive, drive-root logs, and a packaging script were all gone. Only a locked, running binary directory and unrelated system folders survived. The developer estimated six months of engineering work and its own backups were destroyed in one pass, and was able to recover only part of the project by decompiling the one compiled build that had escaped deletion — the original source was not recoverable.

No Cursor staff response appears on the report thread; other community members suggested recovery avenues (Git remotes, Windows Previous Versions, Local History) and argued that destructive filesystem commands should require a separate, explicit confirmation step distinct from approving the analysis that proposed them.

Classification

Agent
Cursor
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 taxonomy

Related incidents

Cite this record
StupidLLM. "STUPID-2026-0148: Cursor agent approved to delete one 18.5GB temp folder instead ran a mis-quoted rmdir that wiped a developer's source, Git repo, and six months of ERP backups." AI Agent Incident Database, 2026. https://www.stupidllm.com/incident/STUPID-2026-0148/ (accessed 2026-11-11). CC BY 4.0.

← STUPID-2026-0147By IDSTUPID-2026-0149 →

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.