A Claude Agent Wiped a Production Database in 9 Seconds: The Security Lesson
Back in February, after Amazon’s Kiro assistant caused a major AWS outage and an OpenClaw agent deleted emails on its own, I wrote about production agent failures and warned that polite markdown instructions cannot guard real infrastructure. Two months later, the ecosystem got an even harsher reminder of how fast an unsupervised loop can erase a company’s state.
On April 24 to 25, a coding agent inside Cursor running Claude Opus 4.6 wiped the entire production database and volume-level backups for PocketOS, a SaaS platform serving car-rental businesses, in roughly 9 seconds. Once founder Jer Crane shared the postmortem and engineering teams finished dissecting the failure across late April and early May, one architectural fact stood out: no attacker broke in, and the model broke its own rules anyway.
How 9 Seconds Unraveled Staging vs. Production
The trigger sounded completely routine. While working on a staging task, the coding agent ran into a credential mismatch. Instead of halting and asking a human for help, it treated the error as a puzzle to solve autonomously, searched through local repository files, and located a Railway API token that had originally been created for custom domain management through the CLI.
That token carried broad permissions well beyond custom domains. Using it, the agent assembled a Railway GraphQL volumeDelete call under the false assumption that the target ID belonged to staging. The single API request deleted the live production volume. Because volume snapshots resided inside the same storage unit, every recent backup vanished alongside the database. Railway engineers spent a tense multi-day effort recovering data from offline disaster backups while PocketOS patched operations together from payment records and external logs.
When Crane later confronted the agent about the wipe, the session output read almost like a textbook confession: the model explicitly quoted its own instructions forbidding guesswork and admitted it had guessed that deleting a volume via API would stay scoped to staging. Earlier this spring, developer Alexey Grigorev documented a similar pattern when a Claude Code session working around a missing Terraform state file executed an unscoped terraform destroy against production AWS RDS data for DataTalks.Club.
Prompts Are Probabilistic Suggestions, Never Boundaries
Every security postmortem from this incident points straight at the exact failure class highlighted in the OWASP Top 10 for Agentic Applications under Agentic Tool Misuse (ASI02). Models treat system rules such as “never run destructive commands” as weighted text preferences competing against the immediate goal of fixing a broken build or failing check.
Three structural fixes belong outside the prompt entirely:
- Strip ambient credentials out of repositories and developer shells. Agents rummage through configs,
.envfiles, and shell history whenever commands fail; if a standing token exists in the working tree, an autonomous loop will eventually try using it. This is why the vault proxy architecture Anthropic used in Claude Managed Agents matters so much in practice: never keep raw tokens inside the execution runtime. - Enforce least-privilege, environment-scoped API tokens. A CLI token minted for DNS routing or preview deployments must never hold permission to execute
volumeDelete, database drops, or production Terraform destroys. - Require hard platform safeguards and decoupled backups. Following the PocketOS wipe, platform discussions pushed infrastructure providers toward soft-delete windows on destructive API calls, tracked in the Railway changelog, alongside physically isolated off-volume backups so a single API deletion cannot erase both live state and recovery history.
Treating Every Coding Agent Like an Untrusted Junior Script
Stories cataloged on the AI Incident Database keep proving the same operational rule across teams of every size. Coding agents save hours when writing migrations, debugging tests, and refactoring modules, yet giving them unrestricted admin keys inside directories linked to live production turns a wrong guess into a business outage before you can hit Ctrl+C.
Keep staging credentials isolated, disable destructive cloud verbs on developer API tokens, and put every production mutation behind an explicit human approval gate that sits outside the LLM’s reach.