Summary
PraisonAI's first-party A2A server example exposes an unauthenticated JSON-RPC endpoint that registers a calculate(expression) tool implemented via Python eval().
When deployed as documented and bound to 0.0.0.0, a remote unauthenticated attacker can drive an LLM to invoke this tool, leading to arbitrary Python code execution and exposure of task metadata.
Affected context
The vulnerability appears in PraisonAI deployments that follow the official A2A example or similar configurations where:
- The A2A JSON-RPC server is exposed on a network interface (e.g., bound to
0.0.0.0) - No authentication or access control is enforced on
/a2a - Tools such as
calculate(expression)are implemented using Pythoneval()or equivalent dynamic code evaluation - A real LLM backend is configured and capable of invoking registered tools
In this context, the A2A surface not only performs tool calls but also exposes task history and cancellation APIs.
Exploit preconditions
- Attack surface: Publicly reachable HTTP endpoint
/a2aon the A2A JSON-RPC server - Required access: None; the endpoint is unauthenticated and accessible to any remote client able to connect
- Trigger point: An attacker sends crafted
message/sendrequests that reachagent.chat(), prompting the LLM to invoke thecalculate(expression)tool - Why exploitation is possible: The
calculatetool directly passes unvalidatedexpressioninput to Pythoneval(), and the tool is callable without any authentication or privilege checks; the same surface also exposes task history and cancellation functionality without authorization.
Why this happens
This issue stems from combining dynamic code execution with an unauthenticated remote interface.
The calculate(expression) tool uses Python's eval() on attacker-controlled input, which is the core pattern behind CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code.
At the same time, the A2A JSON-RPC endpoint is exposed without authentication (CWE-306: Missing Authentication for Critical Function), allowing arbitrary remote users to trigger the tool through LLM-driven workflows.
The design implicitly trusts LLM tool calls and external clients, failing to enforce clear trust boundaries or limit what expressions can be evaluated.
Potential impact
- Remote attackers can execute arbitrary Python code within the A2A server process
- Full compromise of the host running the A2A server, depending on process privileges
- Unauthorized access to task history, including potentially sensitive prompts, responses, and metadata
- Unauthorized task cancellation or manipulation, affecting system integrity and workflow reliability
- Use of the compromised server as a pivot point for further attacks in the surrounding infrastructure
General mitigation guidance
Effective mitigation focuses on both hardening the evaluation mechanism and constraining access to the A2A surface:
- Replace dynamic evaluation (
eval()or similar) with safe interpreters or constrained expression evaluators that operate on a limited grammar and data types - Enforce robust authentication and authorization on A2A endpoints, ensuring only trusted clients can issue
message/sendand task-control requests - Explicitly separate internal tool execution interfaces from public-facing APIs, using network-level controls and segmentation
- Run A2A services with least-privilege accounts and minimal filesystem and network permissions to contain impact if a tool is abused
- Adopt a default-deny posture for tool registration, only enabling tools that operate on validated, non-executable input
How teams detect issues like this
Detection can rely on a mix of code-centric and operational approaches:
- Static analysis rules or linters configured to flag use of
eval()and similar dynamic execution functions in network-exposed or LLM tool contexts - Code review checklists that require explicit justification for any dynamic code evaluation and verification of authentication on JSON-RPC or HTTP endpoints
- Configuration and policy checks ensuring no A2A endpoints bind to
0.0.0.0without explicit access controls or network restrictions - Runtime logging and monitoring for unusual tool invocation patterns, especially expressions containing suspicious Python constructs or filesystem/process operations
- Periodic security testing of LLM tool chains to identify where user-controlled inputs can reach dynamic execution paths

