VulnWatch by ve1ve2
medium 5.3 EPSS 0.18%

GHSA-gj7r-p794-hhq5 / CVE-2026-129235: Kubeshark: MCP `download_file` writes fetched bytes to an unvalidated destination path

Source:
GitHub Security Advisories
Published:
Fetched:
Updated:
Affects:
github.com/kubeshark/kubeshark

https://github.com/advisories/GHSA-gj7r-p794-hhq5 ↗

ghsagoCWE-22CWE-88

Kubeshark: MCP `download_file` writes fetched bytes to an unvalidated destination path **Ecosystem / package:** Go — `github.com/kubeshark/kubeshark` (the `kubeshark` CLI, `kubeshark mcp` subcommand) **Affected component:** `cmd/mcpRunner.go`, MCP tool `download_file` **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 `download_file` 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/authorized_keys`, `~/.kube/config`, `~/.bashrc`), and can request arbitrary Hub API endpoints. `download_file` is registered unconditionally (available in the default, non-`--allow-destructive` posture). ## Introduced in Commit `eb7dc42b` — "Add get_file_url and download_file 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: `export_snapshot_pcap` → obtain a relative path → `download_file` 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):** arbi Affected packages: go:github.com/kubeshark/kubeshark Patched: github.com/kubeshark/kubeshark 0.0.2-0.20260812200004-a76a1920dc75

Linked vulnerabilities (2)

CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:N

Kubeshark: MCP `download_file` writes fetched bytes to an unvalidated destination path

CWE: CWE-22, CWE-88Aliases: CVE-2026-129235
CVE-2026-129235 medium 5.3 EPSS 0.18% (p8) NVDCVE.orgGHSA
CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:N

Kubeshark: MCP `download_file` writes fetched bytes to an unvalidated destination path

CWE: CWE-22, CWE-88Aliases: GHSA-gj7r-p794-hhq5NVD: Received

Also reported by (1)