How the attack works
An attacker crafts input, a prompt, or a manipulated task that causes the agent's LLM to generate output containing Python code, such as calls that spawn processes or touch the filesystem. SuperAGI's output handler code (in output_handler.py) passes this generated content into Python's eval() without validating it first. Because eval() executes arbitrary code, the attacker's payload runs directly on the machine hosting SuperAGI. This affects all versions of SuperAGI since the vulnerable eval() calls are built into the core output-handling logic.
Why it matters
An attacker gains full code execution on the host running the SuperAGI agent, which can lead to data theft, further lateral movement, or complete takeover of the system running the agent — without needing valid credentials.
What you can do
- Do not run SuperAGI versions that still call eval() on LLM-generated output; check for a patched release or apply input sanitization to the output handler yourself.
- Restrict what the SuperAGI agent's LLM output can influence — never let raw model output reach an eval(), exec(), or shell call.
- Run agent frameworks like SuperAGI in isolated, low-privilege environments (containers, restricted service accounts) so a code-execution bug can't reach the wider network.
- Monitor agent output logs for Python code patterns (process spawning, file operations, imports) appearing in fields meant for natural-language content.
Known benign look-alikes
- Legitimate Python educational content discussing eval() safety best practices.
- Static analysis output reporting eval() usage in code review tooling.
- Documentation of CVE-2024-21552 written for defensive purposes.