Summary
Agno versions prior to 2.3.24 contain an eval injection vulnerability in the model execution component, where user-influenced data is passed directly to Python's eval() via the field_type parameter.
An attacker who can control or manipulate field_type within a FunctionCall can execute arbitrary Python code in the Agno process, leading to full remote code execution under the service's privileges.
Affected context
The vulnerability occurs in Agno's model execution logic when evaluating FunctionCall inputs and deriving behavior from the field_type parameter.
It manifests in deployments where:
- Field values or FunctionCall payloads can be influenced by external users or upstream systems, and
- The application directly passes this field_type into Python's eval() without sufficient restriction.
Any environment where untrusted or semi-trusted sources can shape FunctionCall parameters may be affected, including API-driven workflows, integrations, or chained model calls.
Exploit preconditions
- Attack surface: Interfaces that accept or propagate FunctionCall objects or equivalent structures into the model execution component.
- Required access: Ability to submit or modify FunctionCall data such that field_type is attacker-controlled (e.g., via an API, plugin, or integration).
- Trigger point: Invocation of the model execution path that processes a FunctionCall and passes field_type to eval().
- Why exploitation is possible: The implementation treats field_type as trusted code-like input and evaluates it with Python's eval(), allowing arbitrary expressions rather than constraining it to a predefined, data-only set of types.
Why this happens
This issue is rooted in using Python's eval() function on data that can be influenced by external input.
Instead of treating field_type as a simple data descriptor (for example, a string or enum representing a type), the code dynamically evaluates its value, effectively turning untrusted data into executable Python code.
This aligns with CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code, where attackers can inject or alter expressions to run arbitrary commands or access internal objects.
The core pattern is dynamic evaluation of untrusted input without strict whitelisting, sandboxing, or separation between code and data.
Potential impact
- Execution of arbitrary Python code within the Agno runtime process
- Reading, modifying, or deleting sensitive data accessible to the service
- Pivoting to the underlying host or container environment through Python and OS interfaces
- Installing backdoors or persistent malicious logic in the application environment
- Complete compromise of application integrity, including tampering with model logic and outputs
General mitigation guidance
Effective mitigation focuses on eliminating dynamic evaluation of untrusted data and narrowing how types are represented:
- Replace eval() with safe alternatives such as explicit mappings from string identifiers to allowed types or callables.
- Treat field_type as a data-only value (e.g., enum, constant string, or structured configuration) instead of executable code.
- Apply strict validation and normalization of FunctionCall parameters, rejecting or sanitizing unexpected type descriptors.
- Encapsulate model execution in components running with least privilege, limiting filesystem and network access to reduce blast radius.
- Adopt secure defaults where dynamic behavior is disabled unless explicitly required and constrained.
How teams detect issues like this
Organizations can detect and manage this class of vulnerability using:
- Static analysis rules flagging use of eval(), exec(), or similar dynamic evaluation functions, especially on variables derived from request or FunctionCall data.
- Code review practices that require explicit justification for dynamic evaluation and enforce patterns like whitelisting instead of free-form expressions.
- Security linters or CI checks tuned to identify eval injection patterns (e.g., concatenation or direct flow from input parameters to eval()).
- Runtime monitoring and logging of suspicious FunctionCall payloads or abnormal execution paths within model execution components.

