News · mcp-use (open-source project) · 2 min read
Event date: · Published:
mcp-use's built-in Python sandbox can be escaped for code injection
A security advisory published December 1, 2026 shows mcp-use's CodeExecutor sandbox can be escaped via attribute-chain access, letting a remote caller run code through the execute_code tool without authentication.
A security advisory published on December 1, 2026 by GitHub Security Advisories discloses that mcp-use, a Python framework for building MCP-based AI agents, ships a built-in CodeExecutor sandbox that can be escaped, letting a remote caller trigger code injection through the execute_code MCP tool with no authentication required. Full details appear in the mcp-use CodeExecutor code injection via sandbox escape advisory.
What the advisory found
- The vulnerability is tracked as CVE-2026-140133 in GitHub Security Advisory GHSA-c2cv-qv6m-wqf7.
- It carries a CVSS v3.1 score of 7.3 (High) and a CVSS v4.0 score of 5.5 (Medium).
- It is classified as CWE-74, improper neutralization of special elements in output (injection).
- It affects mcp-use versions up to and including 1.7.1.
- The flaw lives in
_build_namespace()insidecode_executor.py: restricting__builtins__by name does not block attribute-chain traversal to objects such assubprocess.Popen. - It can be exploited remotely through the
execute_codeMCP tool with no authentication and low attack complexity.
What it means for people who build with AI
mcp-use is a widely used framework for building MCP client and agent applications, so a sandbox escape in its own code execution tool matters for anyone wiring LLM tool-calling into code execution. The advisory is a reminder that restricting Python's __builtins__ by name does not create a real sandbox: attribute-chain access can still reach dangerous objects already present in the namespace, such as subprocess.Popen, turning a tool call into arbitrary code execution.
Mitigation and next steps
Maintainer guidance states that the built-in Python sandbox executor was never intended for production use and recommends switching to an external sandbox provider instead. The advisory does not specify a fixed version, so teams running mcp-use through version 1.7.1 should disable the built-in executor and route execute_code calls through an external sandbox until further guidance is published.
Sources
- mcp-use CodeExecutor code injection via sandbox escape (CVE-2026-140133) (GitHub Security Advisories, December 1, 2026, official)
Written with AI assistance, strictly from the sources listed above. Before it went live, automated checks verified its dates, sources and every language edition.