Summary
mcp-contextforge-gateway has RestrictedPython sandbox bypass via getattr builtin in pythonsandboxserver
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:
- Raw
getattris exposed insafe_builtins, bypassing_getattr_mediation. validate_codechecks for literal dangerous dunder strings, but the payload constructs those names at runtime.- The
execute_codeMCP 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:
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:
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.
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.
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.
Untrusted input is evaluated as executable code within the application's runtime environment. Typical impact: arbitrary code execution within the application's privilege context.
CVE-2026-53710 has a CVSS score of 10.0 (Critical). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.0.2); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
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.
Frequently Asked Questions
- What is CVE-2026-53710? CVE-2026-53710 is a critical-severity code injection vulnerability in mcp-contextforge-gateway (pip), affecting versions <= 1.0.1. It is fixed in 1.0.2. Untrusted input is evaluated as executable code within the application's runtime environment.
- How severe is CVE-2026-53710? CVE-2026-53710 has a CVSS score of 10.0 (Critical). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of mcp-contextforge-gateway are affected by CVE-2026-53710? mcp-contextforge-gateway (pip) versions <= 1.0.1 is affected.
- Is there a fix for CVE-2026-53710? Yes. CVE-2026-53710 is fixed in 1.0.2. Upgrade to this version or later.
- Is CVE-2026-53710 exploitable, and should I be worried? Whether CVE-2026-53710 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-53710 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-53710? Upgrade
mcp-contextforge-gatewayto 1.0.2 or later.