Summary
Heym's MCP fetch-tools endpoint can start a process using a command and arguments supplied by an authenticated user, including users with the lowest role. Because the process runs on the shared backend before MCP protocol validation, it may cause side effects even if it does not return valid MCP data.
Affected context
The issue affects Heym deployments before version 0.0.75 when the shared backend exposes POST /api/mcp/fetch-tools and accepts the stdio transport. In this path, the endpoint starts the supplied process with attacker-controlled command arguments and an environment merged over os.environ. MCP protocol validation happens after the process has run, so rejecting its response does not prevent execution or side effects.
Exploit preconditions
- Attack surface: The authenticated
POST /api/mcp/fetch-toolsendpoint with stdio transport enabled - Required access: An authenticated Heym account; the described behavior is available to users with the lowest role
- Trigger point: The backend handles a fetch-tools request that supplies a stdio process configuration
- Why exploitation is possible: The backend starts the attacker-supplied command before validating whether the process speaks MCP
Why this happens
The endpoint allows a low-privilege user to influence a process launched by the shared backend, including its command and arguments. Starting attacker-controlled behavior before authorization or trust-boundary checks is an unsafe code-execution pattern associated here with CWE-94: Improper Control of Generation of Code. Later MCP protocol validation does not undo effects that occur during process execution.
Potential impact
- An attacker may execute commands with the backend process's permissions.
- The process could access or alter data available to the shared backend.
- A compromised backend could affect other workloads or users on the same host.
- Attacker-controlled environment values could influence the launched process or its interactions with the host.
General mitigation guidance
Defensive patterns should prevent untrusted users from controlling processes on the shared backend. Gate stdio process launch behind an explicit, narrowly granted capability or an opt-in trust boundary, and apply authorization checks before any process is started. Where process execution is necessary, use a strict executable and argument allowlist, avoid accepting user-controlled environment values, and run processes with minimal permissions and isolation. Treat MCP protocol validation as a separate check, not as a substitute for controlling process launch.
How teams detect issues like this
Review endpoint handlers for process creation reachable from low-privilege routes, especially where request data influences executable names, arguments, or environment variables. Static analysis can flag subprocess APIs receiving request-derived values; code review should verify that authorization and trust checks happen before process creation. Runtime monitoring and policy enforcement can record or restrict backend process launches to approved executables and identities.

