Skip to main content
Agent executes shell commands or eval() with parameters derived from LLM output or user input

How to resolve

Replace eval()/exec() with safe alternatives (ast.literal_eval(), operator-based parsers). Use subprocess with argument lists, never shell=True. Sandbox code execution in containers.

Risk

Governance/Compliance This vulnerability falls under ASI05:2026 — Unexpected Code Execution in the OWASP Top 10 for Agentic Applications. Agent generates or runs code, commands, or scripts without safe sandboxing or review. Security Agent executes shell commands or eval() with parameters derived from LLM output or user input. If exploited, this can compromise the agent’s integrity, confidentiality, or availability, potentially affecting downstream systems and data.

Explanation

Agent executes shell commands or eval() with parameters derived from LLM output or user input. This falls under ASI05 (Unexpected Code Execution): Agent generates or runs code, commands, or scripts without safe sandboxing or review.

Specifications

Trigger
  • Agent scan detects agent executes shell commands or eval() with parameters derived from LLM output or user input
The scanner looks for patterns such as:
  • eval(x) where x comes from LLM or user
  • exec(script_content)
  • subprocess.run(shell=True)
  • os.system(cmd)
  • CodeInterpreterTool with no sandbox
Severity
  • CRITICAL
Applies to: Agent