CVE-2025-66404
mcp-server-kubernetes potential security issue in exec_in_pod tool
MCP Server Kubernetes is an MCP Server that can connect to a Kubernetes cluster and manage it. Prior to 2.9.8, there is a security issue exists in the exec_in_pod tool of the mcp-server-kubernetes MCP Server. The tool accepts user-provided commands in both array and string formats. When a string format is provided, it is passed directly to shell interpretation (sh -c) without input validation, allowing shell metacharacters to be interpreted. This vulnerability can be exploited through direct command injection or indirect prompt injection attacks, where AI agents may execute commands without explicit user intent. This vulnerability is fixed in 2.9.8.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- High
- Privileges needed
- High
- User interaction
- Required
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
6.4
mcp-server-kubernetes potential security issue in exec_in_pod tool
MCP Server Kubernetes is an MCP Server that can connect to a Kubernetes cluster and manage it. Prior to 2.9.8, there is a security issue exists in the exec_in_pod tool of the mcp-server-kubernetes MCP Server. The tool accepts user-provided commands in both array and string formats. When a string format is provided, it is passed directly to shell interpretation (sh -c) without input validation, allowing shell metacharacters to be interpreted. This vulnerability can be exploited through direct command injection or indirect prompt injection attacks, where AI agents may execute commands without explicit user intent. This vulnerability is fixed in 2.9.8.
- Record
CVE-2025-66404- CVSS 3.1
- 6.4 Medium
CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-77
- Updated
- 2026-11-02
EUVDEUVD-2025-201109
6.4
MCP Server Kubernetes is an MCP Server that can connect to a Kubernetes cluster and manage it. Prior to 2.9.8, there is a security issue exists in the exec_in_pod tool of the mcp-server-kubernetes MCP Server. The tool accepts user-provided commands in both array and string formats. When a string format is provided, it is passed directly to shell interpretation (sh -c) without input validation, allowing shell metacharacters to be interpreted. This vulnerability can be exploited through direct command injection or indirect prompt injection attacks, where AI agents may execute commands without explicit user intent. This vulnerability is fixed in 2.9.8.
- Record
EUVD-2025-201109- CVSS 3.1
- 6.4 Medium
CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-wvxp-jp4w-w8wg
6.4
mcp-server-kubernetes has potential security issue in exec_in_pod tool
Summary
A security issue exists in the exec_in_pod tool of the mcp-server-kubernetes MCP Server. The tool accepts user-provided commands in both array and string formats. When a string format is provided, it is passed directly to shell interpretation (sh -c) without input validation, allowing shell metacharacters to be interpreted. This vulnerability can be exploited through direct command injection or indirect prompt injection attacks, where AI agents may execute commands without explicit user intent.
Details
The MCP Server exposes the exec_in_pod tool to execute commands inside Kubernetes pods. The tool supports both array and string command formats. The Kubernetes Exec API (via @kubernetes/client-node) accepts commands as an array of strings, which executes commands directly without shell interpretation. However, when a string format is provided, the code automatically wraps it in shell execution (sh -c), which interprets shell metacharacters without any input validation.
When string commands contain shell metacharacters (e.g., ;, &&, |, >, <, $), they are interpreted by the shell rather than being passed as literal arguments, allowing command injection. This vulnerability can be exploited in two ways:
- Direct command injection: Users or attackers with access to the MCP server can directly inject malicious commands through the tool interface.
- Indirect prompt injection: Malicious instructions embedded in data (e.g., pod logs) can trick AI agents into executing commands without explicit user intent.
Code pattern
The following snippet illustrates the code pattern used in the exec_in_pod tool:
File: src/tools/exec_in_pod.ts
export async function execInPod(
k8sManager: KubernetesManager,
input: {
name: string;
namespace?: string;
command: string | string[]; // User-controlled input
container?: string;
shell?: string;
timeout?: number;
context?: string;
}
): Promise<{ content: { type: string; text: string }[] }> {
const namespace = input.namespace || "default";
let commandArr: string[];
if (Array.isArray(input.command)) {
commandArr = input.command;
} else {
// User input passed to shell
const shell = input.shell || "/bin/sh";
commandArr = [shell, "-c", input.command]; // Shell metacharacters are interpreted
}
// ... Kubernetes Exec API call ...
exec.exec(
namespace,
input.name,
input.container ?? "",
commandArr, // Executed inside pod via shell
stdoutStream,
stderrStream,
stdinStream,
true,
callback
);
}
When input.command is a string, the code automatically wraps it in a shell command (/bin/sh -c), which interprets shell metacharacters. There is no input validation to detect or block shell metacharacters, allowing arbitrary command execution through command chaining (e.g., id>/tmp/TEST && echo done).
PoC
Direct command injection via MCP Inspector
This demonstrates command injection through direct tool invocation:
-
Start a Kubernetes cluster (e.g., using minikube):
minikube start -
Create a test pod:
kubectl run test-pod --image=busybox --command -- sleep 3600 -
Open the MCP Inspector:
npx @modelcontextprotocol/inspector -
In MCP Inspector:
- Set transport type:
STDIO - Set the
commandtonpx - Set the arguments to
-y mcp-server-kubernetes --stdio - Click Connect
- Go to the Tools tab and click List Tools
- Select the
exec_in_podtool
- Set transport type:
-
Verify the file
/tmp/TESTdoes NOT exist before execution:kubectl exec test-pod -n default -- cat /tmp/TEST cat: /tmp/TEST: No such file or directory -
In MCP Inspector, fill in the fields:
- Name field:
test-pod - Namespace field:
default - Command field:
"id>/tmp/TEST && echo done"(include quotes) …
- Name field:
- Record
GHSA-wvxp-jp4w-w8wg- CVSS 3.1
- 6.4 Medium
CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-77
- Updated
- 2026-11-02
NVD
6.4
MCP Server Kubernetes is an MCP Server that can connect to a Kubernetes cluster and manage it. Prior to 2.9.8, there is a security issue exists in the exec_in_pod tool of the mcp-server-kubernetes MCP Server. The tool accepts user-provided commands in both array and string formats. When a string format is provided, it is passed directly to shell interpretation (sh -c) without input validation, allowing shell metacharacters to be interpreted. This vulnerability can be exploited through direct command injection or indirect prompt injection attacks, where AI agents may execute commands without explicit user intent. This vulnerability is fixed in 2.9.8.
- Record
CVE-2025-66404- CVSS 3.1
- 6.4 Medium
CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:H - CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-77
- Updated
- 2026-11-02
OSV
6.4
mcp-server-kubernetes potential security issue in exec_in_pod tool
MCP Server Kubernetes is an MCP Server that can connect to a Kubernetes cluster and manage it. Prior to 2.9.8, there is a security issue exists in the exec_in_pod tool of the mcp-server-kubernetes MCP Server. The tool accepts user-provided commands in both array and string formats. When a string format is provided, it is passed directly to shell interpretation (sh -c) without input validation, allowing shell metacharacters to be interpreted. This vulnerability can be exploited through direct command injection or indirect prompt injection attacks, where AI agents may execute commands without explicit user intent. This vulnerability is fixed in 2.9.8.
- Record
CVE-2025-66404- CVSS 3.1
- 6.4 Medium
CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-77
- Updated
- 2026-11-02
OSVGHSA-wvxp-jp4w-w8wg
6.4
mcp-server-kubernetes has potential security issue in exec_in_pod tool
Summary
A security issue exists in the exec_in_pod tool of the mcp-server-kubernetes MCP Server. The tool accepts user-provided commands in both array and string formats. When a string format is provided, it is passed directly to shell interpretation (sh -c) without input validation, allowing shell metacharacters to be interpreted. This vulnerability can be exploited through direct command injection or indirect prompt injection attacks, where AI agents may execute commands without explicit user intent.
Details
The MCP Server exposes the exec_in_pod tool to execute commands inside Kubernetes pods. The tool supports both array and string command formats. The Kubernetes Exec API (via @kubernetes/client-node) accepts commands as an array of strings, which executes commands directly without shell interpretation. However, when a string format is provided, the code automatically wraps it in shell execution (sh -c), which interprets shell metacharacters without any input validation.
When string commands contain shell metacharacters (e.g., ;, &&, |, >, <, $), they are interpreted by the shell rather than being passed as literal arguments, allowing command injection. This vulnerability can be exploited in two ways:
- Direct command injection: Users or attackers with access to the MCP server can directly inject malicious commands through the tool interface.
- Indirect prompt injection: Malicious instructions embedded in data (e.g., pod logs) can trick AI agents into executing commands without explicit user intent.
Code pattern
The following snippet illustrates the code pattern used in the exec_in_pod tool:
File: src/tools/exec_in_pod.ts
export async function execInPod(
k8sManager: KubernetesManager,
input: {
name: string;
namespace?: string;
command: string | string[]; // User-controlled input
container?: string;
shell?: string;
timeout?: number;
context?: string;
}
): Promise<{ content: { type: string; text: string }[] }> {
const namespace = input.namespace || "default";
let commandArr: string[];
if (Array.isArray(input.command)) {
commandArr = input.command;
} else {
// User input passed to shell
const shell = input.shell || "/bin/sh";
commandArr = [shell, "-c", input.command]; // Shell metacharacters are interpreted
}
// ... Kubernetes Exec API call ...
exec.exec(
namespace,
input.name,
input.container ?? "",
commandArr, // Executed inside pod via shell
stdoutStream,
stderrStream,
stdinStream,
true,
callback
);
}
When input.command is a string, the code automatically wraps it in a shell command (/bin/sh -c), which interprets shell metacharacters. There is no input validation to detect or block shell metacharacters, allowing arbitrary command execution through command chaining (e.g., id>/tmp/TEST && echo done).
PoC
Direct command injection via MCP Inspector
This demonstrates command injection through direct tool invocation:
-
Start a Kubernetes cluster (e.g., using minikube):
minikube start -
Create a test pod:
kubectl run test-pod --image=busybox --command -- sleep 3600 -
Open the MCP Inspector:
npx @modelcontextprotocol/inspector -
In MCP Inspector:
- Set transport type:
STDIO - Set the
commandtonpx - Set the arguments to
-y mcp-server-kubernetes --stdio - Click Connect
- Go to the Tools tab and click List Tools
- Select the
exec_in_podtool
- Set transport type:
-
Verify the file
/tmp/TESTdoes NOT exist before execution:kubectl exec test-pod -n default -- cat /tmp/TEST cat: /tmp/TEST: No such file or directory -
In MCP Inspector, fill in the fields:
- Name field:
test-pod - Namespace field:
default - Command field:
"id>/tmp/TEST && echo done"(include quotes) …
- Name field:
- Record
GHSA-wvxp-jp4w-w8wg- CVSS 3.1
- 6.4 Medium
CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-77
- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
mcp-server-kubernetesnpm |
through 2.9.7 | 2.9.8 |
mcp-server-kubernetesnpm |
before 2.9.8 | 2.9.8 |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2025-66404 is a medium vulnerability (CVSS 6.4) in Flux159 Mcp-server-kubernetes, published December 3, 2025. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.48%, the 74th percentile. Fixed in mcp-server-kubernetes 2.9.8.
References
github.com/Flux159/mcp-server-kubernetes/security/advisories/GHSA-wvxp-jp4w-w8wg
github.com/Flux159/mcp-server-kubernetes/commit/d091107ff92d9ffad1b3c295092f142d6578c48b
github.com/Flux159/mcp-server-kubernetes/commit/47d3136dd272c947464524f11f47bb519814698e
nvd.nist.gov/vuln/detail/CVE-2025-66404
github.com/advisories/GHSA-wvxp-jp4w-w8wg
github.com/CVEProject/cvelistV5/tree/main/cves/2025/66xxx/CVE-2025-66404.json
github.com/Flux159/mcp-server-kubernetes
Left out here: the rest of 2 source descriptions. The JSON record has them.