MCP servers have vulnerabilities too: command injection and arbitrary file write

In this article
Kubeshark's start_kubeshark MCP tool once contained a High-severity argument injection vulnerability (injecting arguments into a command), assigned CVE-2026-129236. The caller-supplied pod_regex parameter was concatenated directly into the kubeshark tap command without an option-terminating delimiter, so a value beginning with a hyphen was interpreted as a flag. An attacker could exploit this to change the deployment image to their own registry and take over the cluster. The bug was fixed in version v53.4.0.
Where the vulnerability lies
The affected component is cmd/mcpRunner.go, specifically the start_kubeshark MCP tool under the kubeshark mcp subcommand of the CLI. This tool builds a kubeshark tap command by placing pod_regex in as a raw element, without a -- to signal the end of the options. Because tap is a cobra command, and cobra parses flags regardless of position, a pod_regex starting with - or --set= is treated as a flag rather than as a regular expression for selecting pods.
Exploitation and impact
The scenario described is one where the attacker can influence the tool's arguments, for example through indirect prompt injection (injecting instructions indirectly into content the agent ingests) targeting an agent that is driving kubeshark mcp --allow-destructive. The attacker can then inject arbitrary --set values to override Helm values, notably tap.docker.registry and tap.docker.tag, thereby redirecting the worker, hub and front images to a registry the attacker controls.
Severity assessment
AV:N changed to AV:L: kubeshark mcp is a local MCP server over stdio, with no network listener. The payload arrives as content that the agent on that machine ingests and then replays as a local tool call, so the exploited interface is local.
PR:N changed to PR:H: the target machine must meet two administrative conditions. The operator must have deliberately enabled the non-default --allow-destructive flag, and the machine must already have a kubeconfig with enough privileges to deploy Kubeshark's privileged DaemonSet. The attacker merely borrows the existing privileged context.
AC:H is kept because the injected content must make it into what the agent ingests, and the attacker must set up a malicious registry or image.
UI:R is kept because an operator must be driving the agent.
S:C is kept because the compromise extends beyond the CLI's authorization scope to the Kubernetes cluster, the factor that keeps the score in the High range.
In terms of classification, the bug falls under CWE-88, the improper neutralization of argument delimiters in a command.
Scope of impact and patch
The bug has existed since the first release that included the MCP command. The affected versions run from v53.1.0 up to but not including v53.4.0, with v53.3.0 being the last affected release. The bug originates from commit 0bbbb473, which added the MCP server on 2026-02-06. Since the tool's inception, pod_regex has always been concatenated as a bare positional argument, so there was no regression window: every release that supports MCP is affected.
Temporary mitigations
For systems that cannot be upgraded yet, the mitigations described include:
Do not run kubeshark mcp with --allow-destructive unless truly necessary.
Do not expose the MCP server to untrusted content or agent input.
Restrict the kubeconfig and the privileges available on the machine running the MCP server.
Key points
The cause is that pod_regex is concatenated into the kubeshark tap command without --, so input starting with a hyphen is interpreted by cobra as a flag.
An attacker can override tap.docker.registry and tap.docker.tag to deploy a malicious image into the privileged DaemonSet, leading to cluster-admin takeover.
Kubeshark rates it 7.2 High with AV:L and PR:H, because the bug is exploitable only when the operator enables --allow-destructive on a machine that already has deployment privileges.
All versions from v53.1.0 up to but not including v53.4.0 are affected, and v53.4.0 fixes it by placing pod_regex after --.
If you have not upgraded, avoid --allow-destructive, do not feed untrusted input to the MCP server, and restrict kubeconfig privileges on the machine running it.


