/

CVE-2026-25546

Severity:

HIGH RISK

(7.8)

OS Command Injection in Godot MCP executeOperation Handler

CVE-2026-25546

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution

Severity:

HIGH RISK

(7.8)

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

Godot MCP contained an OS command injection vulnerability where user-controlled parameters such as projectPath were passed directly into exec() for shell execution.

An attacker able to invoke tools that accept projectPath (for example create_scene, add_node, or load_sprite) could inject shell metacharacters and execute arbitrary system commands with the privileges of the MCP server process.

Affected context

This vulnerability appears in deployments using the Godot MCP server where:

  • Client tools can invoke operations that accept a projectPath or similar path argument
  • The server constructs shell commands incorporating this input and executes them with exec() or a comparable shell-spawning API
  • The MCP process runs with sufficient privileges to impact the underlying system or game development environment

The issue is most relevant when Godot MCP is exposed to untrusted clients, shared environments, or integrated into workflows where users are not fully trusted.

Exploit preconditions

  • Attack surface: Network-accessible or IPC-exposed Godot MCP server handling MCP tool requests
  • Required access: Ability to call affected tools (e.g., create_scene, add_node, load_sprite) and supply the projectPath parameter or any similarly handled parameter
  • Trigger point: Invocation of executeOperation (or equivalent dispatcher) that builds a shell command string containing user-controlled input and passes it to exec()
  • Why exploitation is possible: The implementation concatenates untrusted input directly into a shell command without proper quoting, escaping, or avoiding the shell, allowing injection of metacharacters such as &, ;, or $() that the shell interprets as separate commands

Why this happens

The underlying bug is a classic OS command injection issue, mapped to CWE-78.

The executeOperation function used string interpolation or concatenation to embed user-controlled data (such as projectPath) into a command passed to exec(), which in turn spawns a shell.

Because the shell parses special characters and constructs, any lack of strict validation, proper escaping, or shell-free execution transforms benign parameters into an opportunity to append or replace commands.

This pattern is inherently unsafe: treating input data as part of an executable command line rather than as a purely data parameter passed to a non-shell API.

Potential impact

  • Execution of arbitrary system commands under the MCP server's account
  • Reading, modifying, or deleting files accessible to the MCP process (including game project assets and scripts)
  • Dropping backdoors or additional tooling onto the host system
  • Pivoting to other services or resources reachable from the MCP host
  • Interference with development workflows, including sabotage of project content or CI integrations
  • Potential data exfiltration of proprietary assets, source code, or credentials stored on the system

General mitigation guidance

Effective mitigation focuses on removing the shell from the execution path and strictly treating user input as data:

  • Prefer APIs that execute binaries directly without invoking a shell (e.g., execFile, spawn with argument arrays, or equivalent process APIs in the chosen language/runtime)
  • Avoid constructing command strings via concatenation or interpolation; instead pass user-supplied values as separate arguments in structured arrays
  • Restrict the set of allowed operations on file-system paths to a well-defined subset, such as project directories, and normalize paths before use
  • Enforce strict validation on path-like inputs, including:
  • Rejecting shell metacharacters, newlines, and other control characters
  • Rejecting absolute paths or .. segments if the operation should be scoped to a project root
  • Run the MCP server with least-privilege OS accounts and minimized filesystem permissions
  • Implement defense-in-depth controls such as OS-level sandboxing or containerization to limit the blast radius if a command path is compromised

How teams detect issues like this

Detection generally combines code-centric review with runtime monitoring:

  • Static analysis and code scanning:
  • Flag uses of exec, system, or equivalent shell-spawning APIs where parameters include untrusted input
  • Identify string concatenation or template literals that build shell commands with user-controlled fields (e.g., projectPath)
  • Enforce linting rules that disallow generic command execution APIs except in vetted, reviewed locations
  • Code review practices:
  • Treat any call that executes OS commands as a security-sensitive sink requiring explicit review
  • Verify that all path and command parameters are either constants, from trusted configuration, or passed as structured arguments with proper validation
  • Runtime and operational monitoring:
  • Monitor process creation events originating from the MCP server user or container, alerting on unusual commands
  • Use host-based intrusion detection to spot suspicious shells or tool invocations spawned by MCP
  • Automated code review tools and SAST platforms can be configured with rules specific to command injection patterns in the language/runtime used by Godot MCP.

Sources

SourceLink
github.comgithub.com/Coding-Solo/godot-mcp/commit/21c785d923cfdb471ea60323c13807d62dfecc5a
github.comgithub.com/Coding-Solo/godot-mcp/issues/64
github.comgithub.com/Coding-Solo/godot-mcp/pull/67
github.comgithub.com/Coding-Solo/godot-mcp/security/advisories/GHSA-8jx2-rhfh-q928

Frequently asked

questions

Yes, if the Godot MCP server is reachable over a network or IPC channel by an attacker who can invoke tools that accept projectPath or similar parameters. In such configurations, crafted requests can lead directly to remote code execution.

The attacker must be able to submit requests to the MCP server that trigger executeOperation with attacker-controlled input. No direct shell or OS-level access is required; only access to the MCP interface that exposes the vulnerable tools.

The most robust fix is to stop constructing shell command strings with user input and avoid exec()-style APIs entirely. Use process-execution APIs that take argument arrays, validate and normalize inputs (especially paths), and constrain operations to a defined project root and known-safe executables.

Establish coding standards that forbid shell-based execution of user-controlled data, require input validation on all externally sourced parameters, and treat command execution calls as security-critical code. Combine these practices with automated static analysis, code review checklists, and least-privilege deployment of services like Godot MCP.

Find out what's already
exploitable in your codebase.