/

CVE-2026-53710

Severity:

CRITICAL RISK

(10.0)

Code Injection (CWE-94) in Context Forge Python Sandbox

CVE-2026-53710

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94, CWE-693

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(10.0)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A critical code-injection vulnerability in the MCP Context Forge Python sandbox allows untrusted code submitted through the execute_code MCP tool to escape intended restrictions and execute operating-system commands.

The risk is greatest when the sandbox is exposed through an unauthenticated HTTP or SSE transport, although stdio-only deployments generally have a narrower attack surface.

Affected context

The vulnerability occurs in the python_sandbox_server subproject, specifically its FastMCP server implementation. It may affect deployments that expose the execute_code tool through HTTP or SSE without authentication and that rely on runtime validation to prevent access to sensitive Python capabilities. Core Context Forge gateway and proxy components are not directly implicated by this issue.

Exploit preconditions

  • Attack surface: The Python sandbox's execute_code MCP tool, particularly over HTTP or SSE transport
  • Required access: The ability to invoke the exposed MCP tool; unauthenticated exposure increases accessibility
  • Trigger point: Processing and execution of submitted Python code by the sandbox server
  • Why exploitation is possible: Raw attribute access is exposed through safe_builtins, a required attribute-access guard is absent, and validation focuses on detecting literal dangerous names rather than preventing their runtime construction
  • Deployment consideration: Stdio-only deployments generally provide reduced network reachability, but local or otherwise authorized callers may still matter

Why this happens

The underlying bug is an incomplete sandbox boundary. The server exposes raw getattr behavior without enforcing the required _getattr_-style guard and relies on checks for literal dangerous dunder strings. Because restricted names can be constructed dynamically, validation does not reliably constrain Python object traversal. This can allow access to powerful runtime objects and operating-system process functionality, mapping primarily to CWE-94: Improper Control of Generation of Code and secondarily to CWE-693: Protection Mechanism Failure.

Potential impact

  • An attacker may execute arbitrary operating-system commands with the server process privileges
  • The sandbox process and its accessible data could be compromised
  • Credentials, environment variables, or service tokens may be exposed
  • The host or container could be used for lateral movement
  • Connected MCP, A2A, REST, or gRPC resources could be manipulated or abused
  • Availability could be affected through unauthorized process execution

General mitigation guidance

Mitigation should focus on treating sandboxing as a defense-in-depth boundary rather than relying on string-based validation alone.

Common defensive patterns include:

  • Removing raw reflective operations such as unrestricted attribute access from the permitted execution environment
  • Enforcing an explicit allowlist of language features, objects, methods, and modules
  • Applying structural and semantic policy checks that cannot be bypassed by dynamically constructed names
  • Requiring authentication and authorization for HTTP and SSE tool exposure
  • Preferably isolating untrusted execution in a separate, tightly restricted process or workload
  • Running the sandbox with minimal operating-system privileges, restricted filesystem access, and limited network connectivity
  • Avoiding exposure of secrets and high-value service credentials to the sandbox process
  • Applying resource limits, execution timeouts, and process containment controls

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis rules identifying raw reflection, unrestricted getattr, dynamic object traversal, and broad built-in exposure in sandbox code
  • Code review checks for denylist-only validation, especially checks based solely on literal dangerous strings
  • Tests that evaluate dynamically constructed identifiers and indirect access paths
  • Policy enforcement requiring authentication and authorization on network-exposed MCP tools
  • Runtime monitoring for unexpected child-process creation, shell activity, filesystem access, and outbound connections from sandbox workers
  • Automated security review tools that flag incomplete interpreter isolation and missing sandbox guards

Sources

SourceLink
github.comgithub.com/IBM/mcp-context-forge/commit/63a2900e6301b9c8a483a38d3737a1beb3a7ce89
github.comgithub.com/IBM/mcp-context-forge/releases/tag/v1.0.2
github.comgithub.com/IBM/mcp-context-forge/security/advisories/GHSA-xm98-3vcf-fph7

Frequently asked

questions

It may be remotely exploitable when the Python sandbox's execute_code tool is exposed through an HTTP or SSE transport, particularly without authentication. Stdio-only deployments usually have reduced network reachability.

The attacker needs the ability to invoke the affected MCP tool. In an unauthenticated network deployment, that access may be available to anyone who can reach the service.

Use a properly isolated execution environment with explicit allowlists, remove unrestricted reflection and dangerous built-ins, and enforce authentication and authorization for network transports.

Combine language-level restrictions with operating-system isolation, least privilege, resource limits, network controls, and security tests that cover dynamically constructed access paths rather than only literal forbidden strings.

Find out what's already
exploitable in your codebase.