Zero Labs
Industry News / AI

How to Secure a Shared Lmcache Server on Kubernetes

Source · Towards AI By Aditya Jha

From the publisher’s feed, collected in the ZeroLabs newsroom.

What October’s LMCache CVE teaches about running a KV cache as a shared service, and the setup I’d useIn October, a vulnerability in LMCache let anyone who could reach one network port run their own code as root, the admin account that can do anything, inside the cache server’s container. LMCache is an open-source add-on for vLLM, the program many teams use to serve AI models, and most of these setups run on Kubernetes, the system that schedules programs across a fleet of machines.The LMCache team fixed it in 0.5.6, which shipped in mid-October. The lesson is bigger than one bug. LMCache can now run as a separate server of its own, and a separate server needs the same network care as any other shared service. The quick-start Kubernetes example is built to get you running, so hardening it for production is your job. That takes a few configuration changes, a rebuilt image and one coordinated restart.LMCache stores the KV cache, the model’s working memory for a conversation, so the model doesn’t recompute it on every request. That’s what makes long prompts fast, and it’s why LMCache shows up in the vLLM cluster designs I work on.Picture LMCache as a desk drawer. Normally it sits inside the vLLM process and only that process can open it. LMCache’s multiprocess mode, MP mode for short, moves the drawer into its own filing room down the corridor, so several offices can share one set of files. Sharing is the right call, and a shared room needs a lock on the door. RPC authentication is planned for 0.5.7. Until then, the lock is your network setup.LMCache is a separate server nowThe LMCache docs describe a “DaemonSet + Deployment pattern: one LMCache server per node (DaemonSet) shared by multiple vLLM pods (Deployment).” A DaemonSet runs one copy of a program on every node. A Deployment runs as many copies as you ask for, and each running copy is a pod. vLLM pods connect through LMCacheMPConnector. The cache server holds KV data for every vLLM pod on that GPU node (one machine in the cluster with GPUs) and outlives each of them.A server that runs for months, holds shared state and answers on a network port behaves like Redis, the in-memory database many backends use as a cache. It inherits the security checklist Redis operators have followed for years, and the quick-start example leaves that checklist to you.What the CVE wasCVE-2026–105192 scores 9.8 out of 10 on CVSS, the industry’s standard severity score. It affects LMCache 0.3.9 through 0.5.5, plus the 0.5.6 release candidates rc1 to rc3 (pre-release test builds). Only MP mode is affected, because that’s the mode that runs the separate cache server that accepts these messages. Even then the port listens on 127.0.0.1 by default, meaning this machine only. It’s exposed when --host is set to an address other machines can reach, and the project's own Kubernetes example set it to 0.0.0.0, which listens on every network interface.The mechanism is an old one. The cache server decoded one kind of incoming message with Python’s pickle, a format that can carry instructions as well as data. From Python's docs: "It is possible to construct malicious pickle data which will execute arbitrary code during unpickling." The server took those messages over ZeroMQ (a messaging library) on port 5555, with no authentication. One crafted message ran code as the cache server process. In the official images that process runs as root.On an exposed setup, whoever sends that message can run code as root inside the cache server, on a GPU node that is usually among the most expensive you run. The cache holds data derived from every conversation served on that node. The container also sits on the host network and mounts the host’s shared memory, so from there an attacker can reach other workloads’ shared memory and any service listening on the node’s network, not only the cache.Yuval Moravchick of JFrog reported the bug, and it was disclosed on October 7, before a fix existed. LMCache 0.5.6 shipped in mid-October and swapped pickle for versioned, typed MessagePack, which carries only data. It also moved the admin HTTP servers from 0.0.0.0 to 127.0.0.1 and gated POST /run_script, an endpoint that before 0.5.6 was served on every interface with no authentication.Why the quick-start example needs hardeningThe advisory says to keep the MP transport “on localhost, or on a trusted cluster network only”. A flat pod network isn’t a trusted network, and the shipped example can’t use localhost anyway. Here is the DaemonSet’s YAML configuration file on the v0.5.6 tag, which also moves the port from the default 5555 to 6555:# examples/multi_process/lmcache-daemonset.yaml (abridged)kind: DaemonSetspec: template: spec: hostNetwork: true containers: - image: lmcache/standalone:nightly command: ["/opt/venv/bin/python3", "-m", "lmcache.v1.multiprocess.server", "--host", "0.0.0.0", "--port", "6555"] # no securityContext at pod or container level # /dev/shm mounted from the host as a hostPath volumehostNetwork: true puts the container directly on the node's own network interfaces instead of Kubernetes' private pod network. The vLLM Deployment finds the cache through the node's address:# examples/multi_process/vllm-deployment.yaml (abridged)env:- name: HOST_IP valueFrom: fieldRef: fieldPath: status.hostIP# kv-transfer-config: "lmcache.mp.host": "tcp://${HOST_IP}", "lmcache.mp.port": 6555The vLLM pods live on the pod network, so the cache server has to listen on the node’s real interfaces to be reachable. That means every pod in the cluster, and anything else that can route to the node, can reach port 6555 unless a firewall stops it.NetworkPolicy is how Kubernetes firewalls one pod from another, and it won’t help here. Kubernetes leaves its behaviour for hostNetwork pods undefined, and in practice the network plugin treats their traffic as node traffic, so pod selectors never match it.The pod also fails Pod Security Standards, Kubernetes’ built-in security levels, at Baseline. Baseline is the minimum level that blocks the known ways a pod can escalate to the host. It forbids host namespaces like hostNetwork, and it forbids hostPath volumes, which mount a folder straight from the node. This pod does both. The folder is /dev/shm, the shared-memory folder vLLM and the cache use to exchange data on the same machine.The release post plans a localhost-only example for 0.5.7. If you adopt it, check how your vLLM pods reach the cache, because a pod on the pod network can’t reach the node’s own 127.0.0.1.Borrow the Redis checklistFrom Redis’s security page: “Redis is designed to be accessed by trusted clients inside trusted environments.” Swap in LMCache and the sentence still works. Open Redis instances were hijacked through CONFIG SET, the command that rewrites a running server's settings, and protected mode (plus ACLs later) was part of the answer.Bind address. Redis: docs show binding to 127.0.0.1, and protected mode (since 3.2) answers only loopback when no bind address and no password are configured. LMCache MP 0.5.6: 127.0.0.1 by default, but the example binds 0.0.0.0 on the host network. Do now: never bind a reachable address on the host network.Authentication. Redis: ACLs since Redis 6, legacy requirepass. LMCache MP 0.5.6: no RPC auth in the 0.5.6 release. Do now: restrict who can reach the port.Process user. Redis: “It is recommended to run it as an unprivileged redis user”. LMCache MP 0.5.6: official images run as root. Do now: build a non-root image and set runAsNonRoot.Admin endpoints. Redis: ACL rules plus bind address. LMCache MP 0.5.6: bound to 127.0.0.1 since 0.5.6, and /run_script gated since 0.5.6. Do now: keep them off reachable addresses.LMCache has a second way of passing data, the engine-driven path, that still uses pickle. It’s off by default and can’t be reached over the network, so leave it off.Until RPC authentication and non-root images land, controlling who can reach the port is your main lock.Before 0.5.6, the admin HTTP servers listened on 0.0.0.0, including the MP frontend on port 8080 with its POST /clear-cache endpoint. Run ss -ltnp inside the container to see what yours listens on.Move the cache server onto the pod networkIf you want one cache server per GPU node shared by several vLLM pods, take it off the host network and give it an ordinary pod IP. NetworkPolicy and Pod Security checks apply to it again. The network change needs no new hardware. It costs engineer time, a rebuilt image and one restart of the cache.Each vLLM pod should talk only to the cache on its own machine. A Service gives a group of pods one stable address, and setting internalTrafficPolicy: Local on it (stable since Kubernetes 1.26) keeps each vLLM pod on its own node's cache server. While that cache server restarts, vLLM pods on the node have nowhere to send cache requests and don't fail over to another node, which is right for a node-local cache. I'd keep it that way. Confirm that kube-proxy, the component that routes Service traffic on each node, honors the field in your cluster.With the policy below, only pods labelled vllm can connect. Traffic from the pod's own node is still allowed, which is how kubelet health probes get through, so a compromised process on that node bypasses the policy.You also clear the hostNetwork violation. The pod still fails Baseline while it mounts /dev/shm as a hostPath volume. The deployment guide documents --isolated-ipc (MP connector only, needs cuda-python), which drops the shared-folder dependency for IPC, inter-process communication between vLLM and the cache. That's the route to Baseline and then to Restricted, the strictest level.If you don’t need sharing across pods, run one cache server inside each vLLM pod over localhost. You lose the shared cache, and there’s no port the rest of the cluster can reach. A second container would need the same GPU visible and a shared memory volume for IPC.The manifests below are the target setup. Take them through staging before production and confirm: data still passes between vLLM and the cache after the user change, vLLM keeps serving while a node’s cache server restarts, and vLLM fails cleanly, with a clear connector error, when the cache server rejects its version.apiVersion: v1kind: Servicemetadata: name: lmcache namespace: inferencespec: selector: app: lmcache internalTrafficPolicy: Local ports: - name: zmq port: 5555 targetPort: 5555---apiVersion: networking.k8s.io/v1kind: NetworkPolicymetadata: name: default-deny-ingress namespace: inferencespec: podSelector: {} policyTypes: ["Ingress"]---apiVersion: networking.k8s.io/v1kind: NetworkPolicymetadata: name: lmcache-from-vllm-only namespace: inferencespec: podSelector: matchLabels: app: lmcache policyTypes: ["Ingress"] ingress: - from: - podSelector: matchLabels: app: vllm ports: - protocol: TCP port: 5555These settings run the cache as an ordinary user with no extra Linux privileges, so a break-in lands with far less power than root.spec: hostNetwork: false securityContext: runAsNonRoot: true runAsUser: 10001 seccompProfile: type: RuntimeDefault containers: - name: lmcache image: your-registry/lmcache-standalone:0.5.6-nonroot # built from the Dockerfile; never :nightly command: ["/opt/venv/bin/python3", "-m", "lmcache.v1.multiprocess.server", "--host", "0.0.0.0", "--port", "5555"] # 0.0.0.0 here is the pod IP securityContext: allowPrivilegeEscalation: false capabilities: drop: ["ALL"]Then point vLLM at tcp://lmcache.inference.svc.cluster.local on port 5555 instead of ${HOST_IP}.Without an allow rule, the default-deny policy cuts off your gateway too. Add one for vLLM’s serving port (8000 by default) from your gateway or ingress namespace, and one for your Prometheus namespace if you scrape LMCache metrics on 9090 as the deployment guide does.The labels have to match. The manifests above use app: lmcache and app: vllm in namespace inference, so set the labels and namespace to match your own deployment. A Service whose selector matches nothing fails silently.HTTP health checks break. The guide’s HTTP variant has the kubelet (the agent on each node that starts pods and checks their health) probe /healthcheck on 8080, which fails now that 0.5.6 binds HTTP to 127.0.0.1. Use an exec probe that checks the process from inside the container.Don’t mix versions. A 0.5.5 component can’t talk to a 0.5.6 one, because the wire format changed.The user change needs care too. In legacy IPC mode vLLM and the cache server share /dev/shm, so they have to run as the same UID, the numeric user ID a process runs under.That means runAsUser: 10001 on the vLLM pod too, with its model and cache directories on writable paths. It isn't needed if you use --isolated-ipc. Mount an emptyDir (a scratch folder Kubernetes creates for the pod and deletes with it) for any path the image writes to, such as temp or cache directories.Check that NetworkPolicy is enforcedA NetworkPolicy nobody enforces looks identical to one that works, because the API server accepts the YAML either way. From the Kubernetes docs: “Creating a NetworkPolicy resource without a controller that implements it will have no effect.” Enforcement comes from the CNI, the network plugin that moves packets between pods.Calico and Cilium enforce it. Flannel alone doesn’t (its README says flanneld “does not natively enforce Network Policies”), so pair it with Calico or Cilium. On EKS with the AWS VPC CNI, enforcement is off until you set enableNetworkPolicy in the add-on's configuration. AWS also notes that its strict mode doesn't apply default deny to host-networked pods.If you manage the team, ask whether your cluster enforces NetworkPolicy and how that was checked.To check, schedule a throwaway pod without the app: vllm label onto a node that runs a cache server (set nodeName) and connect straight to the cache server's pod IP on 5555. Don't test through the Service alone. With internalTrafficPolicy: Local, a pod on a node without a cache server fails to connect whether or not policy works.If you have to keep the host network, you need a firewall on the node itself, because pod-level rules don’t see this traffic. Where your CNI gives each node its own pod CIDR (the address range Kubernetes hands to pods on that node), a host firewall rule can accept 6555 only from that range. Check the source IP the node actually sees, because address translation in overlay networks can hide the pod range. The AWS VPC CNI has no per-node pod CIDR, so use security groups for pods or rules that match the local pod interfaces. Calico host endpoint policies and Cilium host policies can be scoped the same way.Upgrade both sides at onceFrom the 0.5.6 release post: “0.5.6 cannot communicate with earlier versions.” The wire format, the exact layout of the messages the two sides exchange, changed. Every vLLM pod and every cache server has to move together.A DaemonSet rolling update doesn’t do that. It replaces cache servers node by node while your vLLM Deployment rolls on its own schedule. The vLLM side’s version is the lmcache package inside your vLLM image, and the example uses lmcache/vllm-openai:latest-nightly, so with nightly tags you can end up with mixed versions without planning any upgrade. Find out in staging what your vLLM version does when the cache server rejects it.A plain kubectl apply gives you that red zone. Blue-green by node pool avoids it by running old and new side by side and switching traffic in one move. Stand up a labeled node pool with the 0.5.6 DaemonSet and a matching vLLM Deployment pinned to it, shift traffic at the load balancer, then drain the old pool (stop sending it new traffic and let in-flight requests finish). You pay for a second set of GPUs during the overlap, so keep the window short.If you can take downtime, recreate is simpler. Scale vLLM to zero, roll the DaemonSet, bring vLLM back, and users lose the service for that window.Either way the warm cache in the cache server’s memory is gone, because the cache server restarts. Until the cache warms up again, repeated long prompts are recomputed from scratch and respond as slowly as if there were no cache. Schedule the cutover for your quietest hour. I compared these strategies in an earlier post, Stop Defaulting to Rolling Updates: 6 Kubernetes Deployment Strategies Explained. For this upgrade, pick blue-green if you can’t take downtime and recreate if you can. Never a plain rolling update.Pin image tags on both sides, watch the vLLM logs for connector errors during cutover, treat any release note that mentions the wire format as a migration, and name one owner for the cutover.What’s planned for 0.5.7The LMCache team has already said what comes next. The 0.5.6 release post plans RPC authentication and a localhost-bound example for 0.5.7, and points to 0.5.7 for non-root images. As of November 11, 0.5.6 is the latest stable release, so re-check all three when 0.5.7 lands. Until then, assume the cache port (5555 by default, 6555 in the shipped example) is reachable by anything you haven’t blocked.If you run LMCache MP mode on Kubernetes, which setup did you land on: host network, pod network, or a cache server inside each vLLM pod? I’d like to compare notes.If this resonated and you want to go deeper on the technical side, the architecture decisions, the infra tradeoffs and the detail that doesn’t fit in a blog post, connect with me on LinkedIn. I’m always up for a good conversation about the unglamorous reality of building AI systems that actually work.How to Secure a Shared Lmcache Server on Kubernetes was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.