Why it matters

Agents that write and run code, or pass generated text to interpreters, can be steered into executing attacker-controlled commands on hosts and containers.

How to prevent it

  • Run generated code only in an isolated sandbox with no secrets, limited network access and resource limits.
  • Prefer narrow, typed tool operations to free-form code or shell execution.
  • Review or approve generated code before it runs outside the sandbox.

Guides on this site

Practice

References

  1. OWASP Top 10 for Agentic Applications for 2026 (OWASP GenAI Security Project, Agentic Security Initiative)

List data from the publisher. A guide is listed as the main subject when the weakness or risk is what the guide is about, and as covering it when a dedicated section or worked example addresses it.