Loading...
Skip to main content

CVE-2026-53710 — Vulnerability in mcp-contextforge-gateway — CVE...

CRITICAL

mcp-contextforge-gateway has RestrictedPython sandbox bypass via getattr builtin in python_sandbox_server

Published August 24, 2026Updated September 10, 2026Source: osv

Summary

**Commit:** `f855e54d5b7bc1c91b977574a03b91eff6b86bb6` **Component:** `mcp-servers/python/python_sandbox_server/src/python_sandbox_server/server_fastmcp.py` ## Vulnerability RestrictedPython's sandbox in ContextForge's `python_sandbox_server` sub-project allows arbitrary Python execution via three compounding weaknesses: 1. Raw `getattr` is exposed in `safe_builtins`, bypassing `_getattr_` mediation. 2. `validate_code` checks for literal dangerous dunder strings, but the payload constructs those names at runtime. 3. The `execute_code` MCP tool can be exposed over HTTP/SSE transport with no authentication layer. ## Proof of Concept The local PoC was executed against the real pinned sandbox code path. It constructs dunder names at runtime, walks Python's class hierarchy through the exposed `getattr`, finds `subprocess.Popen`, and executes a harmless marker command. Transcript excerpt: ```text POC: IBM/mcp-context-forge RestrictedPython getattr sandbox bypass validation={'valid': True, 'message': 'Code passed validation', 'warnings': None} success=True stdout="FOUND_POPEN\nb'IBM_SANDBOX_POC_PASS'\n" IBM_RESTRICTEDPYTHON_GETATTR_POPEN_REPRO_PASS ``` PoC artifact hashes: ```text beb2d856c5a1b7c10005c9c0fccaf3d491d4fbcc2a69bc54b5e95c5730c0874b run.py 1037dcb4f0831a3c96ca728527f939af1d3e19514b23ef54f663707875748ff8 run.sh 7026e676ee31916886f10feed959ffdbe486fda05b17421387e4717acbf90ba6 transcript.txt ``` ## Production Deployment Context ContextForge's documentation describes registering MCP servers as gateways in a running ContextForge instance. If this sandbox server is reachable over HTTP in that pattern, any client that can reach the endpoint can submit the payload through `tools/call`. ## Impact An attacker with access to the `python_sandbox_server` HTTP endpoint can execute OS commands with the privileges of the server process. In containerized deployments with host mounts or internal network reachability, this can become filesystem compromise or network pivoting from the gateway host. ## Suggested Fix Remove raw `getattr` and `setattr` from `safe_builtins`, expose only policy-controlled attribute access if dynamic lookup is required, replace substring filtering with a stricter RestrictedPython policy pipeline, and add authentication to HTTP transport for all `tools/call` requests. ## Caveats This report covers the `python_sandbox_server` sub-project. The core ContextForge gateway and proxy components are not directly affected. The Critical score assumes HTTP reachability; stdio-only deployments reduce the attack vector.

Advisory Timeline

  • First published August 24, 2026 (49 days ago).
  • Last revised September 10, 2026 — 17 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

pip
Update mcp-contextforge-gateway to 1.0.2 or later
pip install "mcp-contextforge-gateway>=1.0.2"

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: pypi (1).

PackageEcosystemAffectedFixed In
mcp-contextforge-gateway
pypi
0.1.0, 0.1.1, 0.2.0, 0.3.0 (+12 more)1.0.2

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-693
    Protection Mechanism FailureMITRE
  • CWE-94
    Code InjectionMITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 10.0 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

Frequently Asked Questions

What is CVE-2026-53710?
mcp-contextforge-gateway has RestrictedPython sandbox bypass via getattr builtin in python_sandbox_server This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 10.0/10).
How do I check if my project is affected by CVE-2026-53710?
CVE-2026-53710 affects mcp-contextforge-gateway. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-53710 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
10.0

Exploitation is straightforward and causes maximum impact. Patch immediately.

Also Known As

GHSA-xm98-3vcf-fph7
PYSEC-2026-3862

Related CVEs

  • CVE-2026-61447
    CRITICAL

    PraisonAI: CodeAgent Executes LLM-Generated Code Without Sandboxing and Leaks All Environment Secrets

  • CVE-2026-61445
    CRITICAL

    PraisonAI: AICoder Arbitrary File Write and Command Execution via LLM Tool Calls

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies