cd /news/ai-agents/why-rm-rf-d-bypasses-almost-every-ai… · home › topics › ai-agents › article
[ARTICLE · art-172351] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↓ negative

Why "rm -rf $D*" Bypasses Almost Every AI Guardrail (And How We Scanned 115k Lines of Production Code)

A developer built BlastRadius-Zero, an open-source, zero-dependency local runtime that sits between autonomous coding agents and the operating system, parsing shell commands into an AST and statically resolving variable, quote and subshell expansions before applying policy. The work follows the GuardFall benchmark, which found nearly every tested pre-execution command guard across 11 coding agents failed to catch obfuscated destructive commands like `D=/; rm -rf $D*`, with Goose leaking on 22 of 23 bypass cases and OpenCode on 16 of 16. The tool also targets MCP context bloat, scoring actions with 50 in-memory adversarial personas in under 50 milliseconds and halting high-risk execution.

recommendation

Parse shell commands into an AST and statically resolve variable, quote and subshell expansions before applying policy, since text-matching guards failed nearly all GuardFall bypass cases.

more in playbook: Securing agents and AI tools
by read4 min views5 publishedNov 19, 2026

Look at this bash command for a moment:

D=/; rm -rf $D*

If you feed that string into almost any commercial AI safety filter, prompt guardrail, or regex-based security rule, it reports:

[Guardrail Status]: PASS (SAFE)
Reason: No literal "/" root directory path detected.

Now ask your operating system's kernel to run it.

Before the command reaches the kernel, bash performs parameter expansion. $D expands to /. The string becomes:

rm -rf /*

The shell executes a recursive wipe of your entire operating system storage.

This is not a hypothetical bug. In the GuardFall academic benchmark published on June 30, 2026, researchers tested pre-execution command guards across 11 actively maintained autonomous coding agents spanning roughly 548,000 GitHub stars.

Almost every single agent failed.

Goose leaked on 22 of 23 bypass cases. OpenCode leaked on 16 of 16. Guardrails were checking what the command looked like. The operating system was executing what the command actually expanded into.

Here is why this disconnect happens, what happened when we pointed an AST resolver at 115,000 lines of viral open-source code, and how we built an open-source flight simulator to fix it.

Most agent guardrails today treat shell commands as plain text. They compile a list of "forbidden substrings":

rm -rf /`` DROP TABLE``chmod 777`` mkfs

  Traditional Guardrail:
  [ AI Output String ] ──( Regex Text Match )──▶ "Looks harmless" ──▶ PASS
                                                                         │
                                                                         ▼
                                                            [ KERNEL EXECUTION ]
                                                            `rm -rf /*` (WIPED)

The problem is that POSIX shells do not execute strings—they compile them through an evaluation pipeline:

"r""m" -rf / has zero literal rm substring, but evaluates to D=/; rm -rf $D* disguises the root path in an environment variable.rm -rf $(echo /) dynamically generates the path at runtime.bash -c "rm -rf /" wraps execution in a child process that evades parent text filters.cat script.sh | sh reads an arbitrary unreviewed script directly into an interpreter. A guard evaluating the pre-transformation string and an operating system executing the post-transformation string are evaluating two completely different commands.

To secure an autonomous coding agent, you cannot use regular expressions. You must parse the shell's Abstract Syntax Tree (AST) and resolve expansions statically before applying policy.

While solving the command evasion problem, we hit an equally devastating bottleneck in the agent ecosystem: Model Context Protocol (MCP) context bloat.

When you connect an autonomous agent (like Cursor or Claude Code) to 8–10 enterprise MCP servers (PostgreSQL, GitHub, Docker, filesystem, Slack), the client injects every single tool schema into the system prompt.

  Without BlastRadius:
  Prompt = [Your 20-word question] + [30,000 tokens of dead schema JSON]
  Cost: $0.30 per query in pure schema overhead
  Latency: 4–8 seconds inference lag
  Hallucination: High (model forgets user instructions)

We spent the last few months engineering a zero-dependency, local-first runtime for autonomous agents called BlastRadius-Zero (blastradius-mcp).

It sits between the agent and your system, functioning like an in-memory flight simulator:

It operates across 4 core architectural pillars:

Before any command executes or any Pull Request merges, BlastRadius unleashes 50 virtual adversarial personas in < 50 milliseconds in-memory:

It outputs a color-coded Blast Heatmap (0–100 Danger Score). If an action scores high risk, execution is physically halted before system state is touched.

It tokenizes shell input, resolves quotes, variable assignments, and subshell wrappers, reconstructing the exact command the kernel will execute. It catches all 23 GuardFall shell bypass classes that fool standard regex filters.

Instead of stuffing 50 tool schemas into prompt memory, BlastRadius exposes one single intelligent dispatcher tool (route_tool).

ctx_981a) with automated PII and API key redaction. Autonomous agents love writing code without tests or swallowing errors in empty try {} catch {} blocks. BlastRadius physically enforces a Red $\rightarrow$ Green $\rightarrow$ Refactor lock: the agent cannot touch production files until it writes a failing test proving the change, makes it pass, and eliminates anti-patterns.

We didn't want to test this on toy benchmarks. We pointed our engine at 115,000 lines of production code across 12 of the most popular open-source repositories in the world:

expressjs/express`` axios/axios``fastify/fastify`` motdotla/dotenv``winstonjs/winston`` Automattic/mongoose``try/catch blocks BlastRadius-Zero is completely open-source under Apache-2.0.

It runs on Node 22+ (leveraging native node:sqlite in WAL mode). It opens no network sockets, sends zero telemetry to the cloud, requires no API keys, and has no paid tier.

You can run it in your terminal right now in 5 seconds:

npx -y blastradius-mcp

Add it to your MCP configuration (mcpServers):

{
  "mcpServers": {
    "blastradius": {
      "command": "npx",
      "args": ["-y", "blastradius-mcp"]
    }
  }
}

Autonomous AI coding agents are the future of software engineering. But letting an agent execute arbitrary shell commands with regex guardrails is like flying a rocket without a pre-flight checklist.

If you are building with Cursor, Claude Code, Cline, or custom agent frameworks, protect your machine and your team's production database before letting agents loose.

⭐ Check out the code, read our 23-bypass test suite, and star the repo on GitHub:

👉 github.com/Jimil-Joshi/blastradius-mcp

(PRs, edge cases, and adversarial persona contributions are very welcome!)

── more in #ai-agents 4 stories · sorted by recency
── more on @blastradius-zero 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/why-rm-rf-d-bypasses…] indexed:0 read:4min 2026-11-19 · —