GHSA-XM98-3VCF-FPH7
Vulnerability from github – Published: 2026-08-24 19:20 – Updated: 2026-08-24 19:20Commit: 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.
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.
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 1.0.1"
},
"package": {
"ecosystem": "PyPI",
"name": "mcp-contextforge-gateway"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.0.2"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-53710"
],
"database_specific": {
"cwe_ids": [
"CWE-94",
"CWE-693"
],
"github_reviewed": true,
"github_reviewed_at": "2026-08-24T19:20:58Z",
"nvd_published_at": null,
"severity": "CRITICAL"
},
"details": "**Commit:** `f855e54d5b7bc1c91b977574a03b91eff6b86bb6`\n**Component:** `mcp-servers/python/python_sandbox_server/src/python_sandbox_server/server_fastmcp.py`\n\n## Vulnerability\n\nRestrictedPython\u0027s sandbox in ContextForge\u0027s `python_sandbox_server` sub-project allows arbitrary Python execution via three compounding weaknesses:\n\n1. Raw `getattr` is exposed in `safe_builtins`, bypassing `_getattr_` mediation.\n2. `validate_code` checks for literal dangerous dunder strings, but the payload constructs those names at runtime.\n3. The `execute_code` MCP tool can be exposed over HTTP/SSE transport with no authentication layer.\n\n## Proof of Concept\n\nThe local PoC was executed against the real pinned sandbox code path. It constructs dunder names at runtime, walks Python\u0027s class hierarchy through the exposed `getattr`, finds `subprocess.Popen`, and executes a harmless marker command.\n\nTranscript excerpt:\n\n```text\nPOC: IBM/mcp-context-forge RestrictedPython getattr sandbox bypass\nvalidation={\u0027valid\u0027: True, \u0027message\u0027: \u0027Code passed validation\u0027, \u0027warnings\u0027: None}\nsuccess=True\nstdout=\"FOUND_POPEN\\nb\u0027IBM_SANDBOX_POC_PASS\u0027\\n\"\nIBM_RESTRICTEDPYTHON_GETATTR_POPEN_REPRO_PASS\n```\n\nPoC artifact hashes:\n\n```text\nbeb2d856c5a1b7c10005c9c0fccaf3d491d4fbcc2a69bc54b5e95c5730c0874b run.py\n1037dcb4f0831a3c96ca728527f939af1d3e19514b23ef54f663707875748ff8 run.sh\n7026e676ee31916886f10feed959ffdbe486fda05b17421387e4717acbf90ba6 transcript.txt\n```\n\n## Production Deployment Context\n\nContextForge\u0027s 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`.\n\n## Impact\n\nAn 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.\n\n## Suggested Fix\n\nRemove 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.\n\n## Caveats\n\nThis 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.",
"id": "GHSA-xm98-3vcf-fph7",
"modified": "2026-08-24T19:20:58Z",
"published": "2026-08-24T19:20:58Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/IBM/mcp-context-forge/security/advisories/GHSA-xm98-3vcf-fph7"
},
{
"type": "WEB",
"url": "https://github.com/IBM/mcp-context-forge/commit/63a2900e6301b9c8a483a38d3737a1beb3a7ce89"
},
{
"type": "PACKAGE",
"url": "https://github.com/IBM/mcp-context-forge"
},
{
"type": "WEB",
"url": "https://github.com/IBM/mcp-context-forge/releases#release-v1.0.2"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H",
"type": "CVSS_V4"
}
],
"summary": "mcp-contextforge-gateway has RestrictedPython sandbox bypass via getattr builtin in python_sandbox_server"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.