CVE-2026-140133: mcp-use CodeExecutor code_executor.py _build_namespace code injection
A vulnerability was determined in mcp-use up to 1.7.1. Affected by this vulnerability is the function buildnamespace of the file libraries/python/mcpuse/client/codeexecutor.py of the component CodeExecutor. Executing a manipulation of the argument code can lead to code injection. The attack can be launched remotely. The project maintainer explains, that the built-in Python sandbox executor is not meant for production use and users should rely on external sandbox providers.
Affected Software
Event History
Frequently Asked Questions
Who is exposed to this issue?
Deployments of mcp-use up to version 1.7.1 that use the built-in Python sandbox executor and pass attacker-influenced content to the CodeExecutor code argument are exposed. The attack can be launched remotely and does not require stated privileges or user interaction.
What does an attacker need to exploit it?
An attacker needs the ability to manipulate the code argument processed by CodeExecutor's _build_namespace function. The supplied data indicates low attack complexity and no required privileges or user interaction.
Are default deployments affected?
The available information identifies the built-in Python sandbox executor as the affected context, but does not state whether it is enabled or used by default. Environments relying on an external sandbox provider are not identified as affected by the description.
What can be done if patching is not immediately possible?
Do not rely on the built-in Python sandbox executor in production. Use an external sandbox provider and prevent untrusted parties from influencing the code argument supplied to CodeExecutor.