/

CVE-2026-85660

Severity:

HIGH RISK

(8.1)

OS Command Injection (CWE-78) in cli-mcp-server 0.2

CVE-2026-85660

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution

Severity:

HIGH RISK

(8.1)

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

cli-mcp-server contains a command allowlist bypass when shell operators are enabled. Shell command substitution can cause non-allowlisted commands to be executed despite ALLOWED_COMMANDS validation, creating a high-severity command injection risk when attacker-controlled command input reaches the validator.

Affected context

The vulnerability occurs in deployments that enable ALLOW_SHELL_OPERATORS and use the command validation logic in cli-mcp-server 0.2.5. It becomes risky when an attacker can influence a command or command fragment that is processed by _validate_command_with_operators, particularly where validation checks the visible command structure without fully accounting for shell evaluation behavior.

Exploit preconditions

  • Attack surface: Command-processing functionality exposed through the MCP server
  • Required access: Ability to submit or influence command input accepted by the server
  • Trigger point: Validation performed by _validate_command_with_operators when shell operators are enabled
  • Why exploitation is possible: Shell substitution syntax may be evaluated by the command interpreter while bypassing the allowlist's command-name validation

Why this happens

The underlying bug is a mismatch between command allowlist validation and shell parsing semantics. The validator permits shell operators but does not comprehensively account for command-substitution constructs that can introduce additional executable commands. This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, where attacker-controlled input reaches a shell execution path without enforcing an equivalent restricted execution model.

Potential impact

  • Attackers may execute commands that are absent from the approved command list
  • The service process or its host environment could be compromised
  • Sensitive files, credentials, or environment variables may be exposed
  • Attackers could alter data, disrupt operations, or establish persistence
  • Downstream systems may be affected when the service has elevated permissions

General mitigation guidance

Mitigation generally focuses on avoiding shell interpretation and ensuring that authorization decisions match the actual execution behavior.

Common defensive patterns include:

  • Prefer direct process execution with fixed argument arrays over shell-based execution
  • Disable shell operators unless they are strictly required
  • Apply command and argument allowlists after parsing into the exact execution model
  • Treat all externally supplied command content as untrusted
  • Use narrowly scoped service accounts and least-privilege operating-system permissions
  • Isolate command-running components and restrict filesystem, network, and credential access
  • Reject ambiguous or unsupported shell constructs rather than attempting partial validation

How teams detect issues like this

Organizations can identify similar risks through:

  • Static analysis rules for shell execution APIs and dynamic command construction
  • Code review checks for allowlists that validate command names without validating arguments and shell syntax
  • Tests covering command substitution, nested operators, quoting, and parser-versus-shell behavior
  • Runtime monitoring for unexpected child processes spawned by the MCP service
  • Policy enforcement that prevents shell execution for services handling untrusted input
  • Automated security review tools that flag command construction and incomplete neutralization controls

Sources

SourceLink
github.comgithub.com/MladenSU/cli-mcp-server
github.comgithub.com/MladenSU/cli-mcp-server/blob/main/src/cli_mcp_server/server.py
github.comgithub.com/MladenSU/cli-mcp-server/issues/17
vulncheck.comvulncheck.com/advisories/cli-mcp-server-0.2.5-command-allowlist-bypass-via-shell-substitution

Frequently asked

questions

Exploitability depends on how cli-mcp-server is exposed. It may be remotely exploitable when an attacker can submit command input through an accessible MCP interface and shell operators are enabled.

An attacker generally needs access to a command-handling function or another workflow that passes attacker-influenced input to the vulnerable validation and execution path.

The safest pattern is to avoid shell interpretation entirely and execute only fixed, validated commands with structured arguments. If shell behavior is unavoidable, validation must model the complete shell grammar and reject unsupported constructs.

Keep shell operators disabled by default, use strict command and argument policies, test parser edge cases, and run the service with minimal operating-system privileges.

Find out what's already
exploitable in your codebase.