Detection Library
criticalexperimentalAI/MLCloudT1485T1490

Destructive Command in LLM Output Prior to Agent Execution

Detects LLM-generated shell or SQL statements containing destructive operations (rm -rf, DROP TABLE, DELETE without WHERE, kubectl delete namespace) before an autonomous agent executes them -- a last-line guardrail for agentic tool-calling pipelines.

Updated Oct 29, 2026 · Detection Engineering Team

llmagentic-aidestructive-commandguardrailowasp-llm05

Problem Statement

Agentic AI systems that can execute real shell, database, or infrastructure commands turn a hallucinated or injected instruction into real-world impact the moment it's executed; OWASP's 2026 guidance on Improper Output Handling specifically calls out the gap between 'the model said this' and 'this should actually run' as the control most agentic deployments skip.

Sample Logs

{"event_type":"tool_call_pending","timestamp":"2026-10-29T13:33:18Z","agent_id":"devops-autofix-agent","user":"system","tool_name":"shell_exec","tool_call_args":"rm -rf / --no-preserve-root  # cleaning up temp build artifacts","approval_status":"auto"}

Required Fields

event_type
tool_call_args
tool_name
agent_id
approval_status
timestamp

False Positives

  • ·Explicitly authorized destructive maintenance agents (e.g. a scoped database-cleanup agent) -- allowlist by agent_id and require human approval regardless
  • ·Pattern matches inside a code comment or documentation string rather than an actually-executed command

Tuning Guidance

This should gate execution (require human approval) rather than only log, for any agent whose tool-calling scope includes shell, SQL, or infrastructure-API access. Reserve auto-approval exclusively for agents with no destructive-capable tools in their toolset.