T08 · Insecure Dependencies
- Location
references/kn-cli.md:35- Finding
Mutable Container Image Executes with Read-Write Access to Kubernetes Credentials
- Content
View full analysis
Vulnerability Details
File Location:
references/kn-cli.md:35
Vulnerability Type: Supply-chain risk from an unpinned executable dependency with access to sensitive credentials
Risk Level: HighComplete Vulnerable Code Snippet:
bash docker run --rm -v "$HOME/.kube/config:/root/.kube/config" gcr.io/knative-releases/knative.dev/client/cmd/kn:latest service listTechnical Analysis
The documented command executes the Knative client container using the mutable
latesttag. A mutable tag can resolve to different image contents over time without any corresponding change to the reviewed Skill. Consequently, the effective executable payload is not cryptographically pinned to the version that was originally assessed.The container also receives a read-write mount of the user's Kubernetes configuration file. This file can contain cluster endpoints, bearer tokens, client certificates, authentication-provider configuration, or references to credential-exec plugins. Code running in the container can read these credentials and may overwrite the mounted kubeconfig.
Combining a mutable executable dependency with credential access creates a supply-chain exposure. This does not establish that the referenced official image is currently malicious; the risk arises if its registry account, publishing pipeline, mutable tag, or image contents are compromised or unexpectedly changed.
Attack Path
- An attacker compromises the upstream image publishing pipeline, registry account, or mutable
latesttag. - The attacker publishes a modified image under
gcr.io/knative-releases/knative.dev/client/cmd/kn:latest. - A user follows the Skill documentation and runs the provided command.
- Docker retrieves and executes the attacker-controlled image.
- The image reads
/root/.kube/configfrom the mounted host file. - The image extracts usable Kubernetes authentication material or uses it directly to contact the c ...[truncated 972 chars]
- An attacker compromises the upstream image publishing pipeline, registry account, or mutable
- Remediation
View remediation
Remediation Suggestions
-
Replace the mutable
latesttag with an immutable, release-specific image digest that has been verified through the official Knative release process:bash docker run --rm \ -v "$HOME/.kube/config:/root/.kube/config:ro" \ gcr.io/knative-releases/knative.dev/client/cmd/kn@sha256:<verified-digest> \ service list -
Mount kubeconfig read-only by adding
:ro, preventing the container from altering the host file. -
Use a dedicated kubeconfig containing a least-privileged service account or user context rather than mounting the user's general administrative configuration.
-
Pin a documented Knative client release version and record its digest so upgrades require an explicit review.
-
Verify image provenance and signatures using the official Knative release metadata and an appropriate verification mechanism before execution.
-
Where practical, use a short-lived Kubernetes token with narrowly scoped RBAC permissions and revoke or expire it after the operation.
-
