/

CVE-2026-55582

Severity:

HIGH RISK

(8.4)

OS Command Injection (CWE-78) in mcp-shell MCP Server

CVE-2026-55582

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary OS Command Execution

Severity:

HIGH RISK

(8.4)

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 command injection vulnerability in mcp-shell allows a caller of the shell_exec MCP tool to execute arbitrary operating-system commands through Git command-line options.

The issue becomes risky when MCP connectivity is available and the server permits /usr/bin/git without enforcing executable-specific argument restrictions.

Affected context

The vulnerability affects mcp-shell deployments that:

  • Enable the shell_exec MCP tool
  • Permit /usr/bin/git through the default security configuration
  • Rely on generic shell metacharacter and dangerous-construct checks
  • Do not apply a per-executable policy to Git arguments

In the default containerized deployment, Git is installed and the service runs as the mcpuser account. Exploitation depends on an attacker being able to connect to the MCP server and invoke the relevant tool.

Exploit preconditions

  • Attack surface: The shell_exec MCP tool exposed through MCP connectivity
  • Required access: Ability to invoke the tool; separate operating-system authentication may not be required if MCP access is already authorized
  • Trigger point: Processing a permitted Git command and its arguments
  • Why exploitation is possible: Git options can define shell-backed aliases, while the security checks do not adequately recognize the relevant metacharacter or enforce a safe argument policy for Git

Why this happens

The root cause is an incomplete command-safety model combined with insufficient validation of arguments for an allowed executable.

The security logic omits an important shell metacharacter and treats executable allowlisting as sufficient, even though Git accepts configuration options that can cause command execution. This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, because attacker-controlled command data reaches an execution-capable processing path without complete neutralization or contextual validation.

Potential impact

  • Arbitrary commands could execute with the privileges of the mcp-shell process
  • The service environment and accessible files could be compromised
  • Credentials, tokens, or other sensitive data could be exposed
  • The container or connected workloads could be altered
  • Attackers could potentially use the service as a foothold for lateral movement

General mitigation guidance

Mitigation generally focuses on reducing shell exposure and treating every executable's arguments as untrusted input.

Common defensive patterns include:

  • Prefer dedicated, non-shell APIs for approved operations
  • Apply strict per-executable argument schemas and reject unsupported Git options
  • Use positive allowlists for commands, subcommands, flags, and values
  • Implement complete, context-aware neutralization of shell metacharacters
  • Avoid relying solely on generic string filters or executable allowlists
  • Run the service with the least privilege and isolate its filesystem and network access
  • Keep sensitive credentials and host interfaces unavailable to the service where possible
  • Require authenticated, authorized MCP access and log tool invocations

These controls reduce the impact of command-injection defects and limit the trust placed in caller-supplied command strings.

How teams detect issues like this

Detection can combine:

  • Static analysis for shell execution APIs, string-based command construction, and incomplete metacharacter filters
  • Code review checks for executable allowlists without argument-level policies
  • Tests using special characters and tool-specific configuration options across all permitted executables
  • Policy enforcement that blocks unrestricted shell tools or requires explicit command schemas
  • Runtime monitoring for unusual Git options, unexpected child processes, and commands launched by the MCP service
  • Audit review of MCP tool calls and process execution telemetry

Automated security scanning and code-review tools may help identify unsafe command construction, but coverage should be supplemented with executable-specific tests.

Sources

SourceLink
github.comgithub.com/sonirico/mcp-shell/commit/f31377fce6ec31114e5a4398c0e5270552bce09f
github.comgithub.com/sonirico/mcp-shell/pull/16
github.comgithub.com/sonirico/mcp-shell/releases/tag/v0.6.0
github.comgithub.com/sonirico/mcp-shell/security/advisories/GHSA-74hp-mggr-hv58

Frequently asked

questions

It can be exploitable over the MCP interface when an attacker can connect to the server and invoke the shell_exec tool. Network reachability and MCP authorization controls determine the practical exposure.

No separate shell or host login is necessarily required. The relevant prerequisite is access to the MCP tool, although deployment-specific authentication and authorization may restrict that access.

Avoid unrestricted shell execution, enforce strict per-executable and per-argument allowlists, and reject Git options that can introduce shell-backed behavior.

Use structured APIs where possible, test command filters against tool-specific parsing features, apply least privilege, and continuously monitor MCP tool invocations and child processes.

Find out what's already
exploitable in your codebase.