PraisonAI CodeAgent is reported to execute LLM-generated code without a sandbox and leak all environment secrets.
PraisonAI: CodeAgent Executes LLM-Generated Code Without Sandboxing and Leaks All Environment Secrets
A GitHub security advisory discloses that PraisonAI's CodeAgent._execute_python() passes the full parent environment via os.environ.copy() when executing LLM-generated Python code in a subprocess, without AST validation or import restrictions, and even explicitly setting CodeConfig(sandbox=True) has no effect. An attacker can influence LLM output through prompt injection, thereby stealing all environment variables such as API keys, database credentials, and cloud tokens, and executing arbitrary code on the host. The PoC in the advisory shows that the Agent can output all secrets by executing code that filters and prints environment variables; in a real attack, the model could be induced to send OPENAI_API_KEY to an attacker's server via urllib. Compared to the sandboxed execute_code tool in python_tools.py that uses env={}, the isolation in this path is reduced to subprocess execution only.
The announcement disclosed the specific mechanism by which a CodeAgent sandbox switch failure exposed all environment variables; teams using the framework can check their own deployments accordingly.