Miggo Logo

CVE-2025-53355:
MCP Server Kubernetes vulnerable to command injection in several tools

7.5

CVSS Score

Basic Information

EPSS Score
-
Published
7/8/2025
Updated
7/8/2025
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
mcp-server-kubernetesnpm< 2.5.02.5.0

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability exists across multiple tools in the mcp-server-kubernetes package. The root cause is the unsafe construction of shell commands using untrusted user input, which are then executed by child_process.execSync. The pattern observed in the patch ab165f5a0eea917fef5dbae954506fff6f4bf514 consistently shows a migration from execSync with a concatenated command string to the safer execFileSync API, which takes arguments as an array, preventing shell interpretation of special characters.

Any function that was modified to replace execSync with execFileSync was previously vulnerable to command injection. An attacker could provide malicious input, such as a;id>/tmp/pwned, in parameters like namespace, name, or other command arguments. When the server constructs the command string, the malicious payload is included and executed, leading to Remote Code Execution (RCE) with the privileges of the server process.

The analysis of the patch reveals that a wide range of functions responsible for interacting with Kubernetes and Helm (e.g., kubectlScale, kubectlPatch, installHelmChart, kubectlGeneric) were affected. The fix applied in the patch systematically remediates this vulnerability by ensuring that user-provided arguments are treated as data and not as executable code by the shell.

Vulnerable functions

installHelmChart
src/tools/helm-operations.ts
The function `installHelmChart` constructs a shell command by concatenating user-provided input (`params.repo`, `params.name`, `params.chart`, `params.namespace`) and executes it using `execSync` via the `executeHelmCommand` helper. This allows an attacker to inject arbitrary shell commands by manipulating the input parameters, leading to remote code execution.
upgradeHelmChart
src/tools/helm-operations.ts
Similar to `installHelmChart`, the `upgradeHelmChart` function is vulnerable to command injection. It builds a command string for `helm upgrade` using user-controlled parameters and executes it, making it possible for an attacker to run arbitrary code on the server.
uninstallHelmChart
src/tools/helm-operations.ts
The `uninstallHelmChart` function directly concatenates the `params.name` and `params.namespace` inputs into a command string for `helm uninstall`. This unsanitized input allows for command injection, leading to remote code execution.
kubectlApply
src/tools/kubectl-apply.ts
The `kubectlApply` function constructs a `kubectl apply` command by concatenating various user-controlled inputs like `input.filename`, `input.namespace`, etc., into a single string. This string is then executed via `execSync`, creating a command injection vulnerability.
kubectlScale
src/tools/kubectl-scale.ts
As highlighted in the vulnerability description, `kubectlScale` builds a `kubectl scale` command by directly embedding user inputs (`input.name`, `input.namespace`, etc.) into a command string. This allows an attacker to inject malicious commands, for example, in the `namespace` parameter.
kubectlPatch
src/tools/kubectl-patch.ts
The `kubectlPatch` function is vulnerable as it constructs a `kubectl patch` command by concatenating user-provided inputs like `input.resourceType`, `input.name`, and `namespace` into a command string, which is then executed. This allows for arbitrary command injection.
kubectlGeneric
src/tools/kubectl-generic.ts
The `kubectlGeneric` function is explicitly designed to run arbitrary `kubectl` commands. It assembles a command string from user inputs (`input.command`, `input.subCommand`, `input.flags`, etc.) and executes it. This is inherently dangerous and directly leads to a command injection vulnerability.

WAF Protection Rules

WAF Rule

### Summ*ry * *omm*n* inj**tion vuln*r**ility *xists in t** `m*p-s*rv*r-ku**rn*t*s` M*P S*rv*r. T** vuln*r**ility is **us** *y t** uns*nitiz** us* o* input p*r*m*t*rs wit*in * **ll to `**il*_pro**ss.*x**Syn*`, *n**lin* *n *tt**k*r to inj**t *r*itr*r

Reasoning

T** vuln*r**ility *xists **ross multipl* tools in t** `m*p-s*rv*r-ku**rn*t*s` p**k***. T** root **us* is t** uns*** *onstru*tion o* s**ll *omm*n*s usin* untrust** us*r input, w*i** *r* t**n *x**ut** *y `**il*_pro**ss.*x**Syn*`. T** p*tt*rn o*s*rv** i