Summary
CVE-2026-51856 is a critical remote code execution vulnerability in AgentScope, an open-source framework for building LLM agents. When a deployment’s RealtimeAgent WebSocket session exposes the execute_python_code tool, a remote, unauthenticated WebSocket client can converse with the agent in a way that causes the underlying language model to invoke that tool, resulting in arbitrary Python code execution in the service environment. The flaw has a CVSS v3.1 base score of 9.8 (Critical).
Technical details
- Root cause:
RealtimeAgent._actingforwards model-produced tool calls directly toToolkit.call_tool_function, which executes theexecute_python_codetool without any additional approval step or sandboxing/isolation boundary. - Trigger condition: The vulnerability requires that a
RealtimeAgentsession hasexecute_python_coderegistered as an available tool, which is a common configuration for agents intended to run code on behalf of users. - Attack vector: A remote client connects to the exposed WebSocket endpoint (e.g., a
ws:///wss://RealtimeAgent session) and, through normal conversational prompting, induces the agent/model to call theexecute_python_codetool with attacker-chosen code. - Impact: Full arbitrary code execution in the context of the service process, which can lead to complete compromise of confidentiality, integrity, and availability of the host running AgentScope. No authentication or user interaction beyond the WebSocket connection is required.
Affected software
- AgentScope versions 1.0.18, 1.0.19, and 1.0.19.post1 when a
RealtimeAgentsession has theexecute_python_codetool enabled.
Severity
- CVSS v3.1 Base Score: 9.8 (Critical)
- Vector:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Mitigation and recommended actions
- Immediate: As of this writing, no official patched release has been confirmed by the vendor. Security teams should monitor the AgentScope GitHub repository for a fixed release and upgrade as soon as one is available.
- Workarounds:
- Disable or remove the
execute_python_codetool (and similar code/shell-execution tools) from anyRealtimeAgentsession that accepts connections from untrusted or unauthenticated remote clients. - Do not expose
RealtimeAgentWebSocket endpoints directly to the internet; place them behind authentication, network access controls, or a gateway that restricts connections to trusted sources. - If code execution tools must be exposed, run the agent process in an isolated, sandboxed, or containerized environment with minimal privileges to limit the blast radius of arbitrary code execution.
- Monitor WebSocket-exposed agent services for anomalous tool-invocation patterns or unexpected code execution tool calls.
- Disable or remove the

