Command Injection Affecting fastmcp package, versions [,3.2.0)


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.03% (11th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Command Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-FASTMCP-15871029
  • published1 Apr 2026
  • disclosed31 Mar 2026
  • creditNil Ash

Introduced: 31 Mar 2026

NewCVE-2025-64340  (opens in a new tab)
CWE-78  (opens in a new tab)

How to fix?

Upgrade fastmcp to version 3.2.0 or higher.

Overview

fastmcp is a The fast, Pythonic way to build MCP servers and clients.

Affected versions of this package are vulnerable to Command Injection via the subprocess-backed install commands. An attacker can execute arbitrary commands with the privileges of the user running the process by supplying a server name containing shell metacharacters, which are interpreted by the Windows command shell when invoking certain CLI wrappers.

Note:

This is only exploitable if the target CLI is installed as a .cmd wrapper on a Windows host.

PoC

from fastmcp import FastMCP

mcp = FastMCP(name="test&calc")

@mcp.tool
def roll_dice(n_dice: int) -> list[int]:
    """Roll `n_dice` 6-sided dice and return the results."""
    return [random.randint(1, 6) for _ in range(n_dice)]

CVSS Base Scores

version 4.0
version 3.1